Module: RGraph::IO::GraphML::Read
- Defined in:
- lib/rgraph/io/graph_ml.rb
Overview
Class methods
Instance Method Summary collapse
-
#read(path, instream = 0) ⇒ Graph
Reads the graph from a GraphML file.
Instance Method Details
#read(path, instream = 0) ⇒ Graph
Reads the graph from a GraphML file.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rgraph/io/graph_ml.rb', line 59 def read(path, instream = 0) file_pointer = Bindings::C.fopen(path, "r") if file_pointer.null? raise "Error: Openning a file with fopen failed." end Graph.new do |graph| Bindings.igraph_read_graph_graphml(graph, file_pointer, instream) Bindings::C.fclose(file_pointer) end end |