pygmtools.utils.from_graphml

pygmtools.utils.from_graphml(filename)[source]

Convert graphml object to adjacency matrix

Parameters

filename – graphml file path

Returns

the adjacency matrix corresponding to the graphml object

Example
>>> import pygmtools as pygm
>>> pygm.set_backend('numpy')

# example file (.graphml) path
>>> G1_path = 'examples/data/graph1.graphml'
>>> G2_path = 'examples/data/graph2.graphml'

# Obtain Adjacency matrix
>>> G1 = pygm.utils.from_graphml(G1_path)
>>> G1.shape
(11,11)

>>> G1 = pygm.utils.from_graphml(G2_path)
>>> G2.shape
(11, 11)