netket.graph.Graph#
- class netket.graph.Graph[source]#
Bases:
AbstractGraphA simple implementation of Graph based on an external graph library.
The underlying implementation is based on igraph and supports conversion to networkx, but this is an implementation detail and could be changed in the future.
- Inheritance

- __init__(edges, n_nodes=None)[source]#
Construct the a graph starting from a list of edges and optionally a given number of nodes.
- Attributes
- edge_colors#
Sequence of edge colors, in the order of the edges returned by
self.edges.
- n_edges#
The number of edges in the graph.
- n_nodes#
The number of nodes (or vertices) in the graph
- Methods
- adjacency_list()[source]#
List containing the adjacency list of the graph where each node is represented by an integer in [0, n_nodes)
- distances()[source]#
Return the integer graph distance between all pairs \(i,j\) of sites in the graph.
The graph distance is the shortest-path length, i.e. the minimum number of edges connecting two sites. The distance between unconnected nodes (no path exists between them) is set to \(-1\).
- edges(*, return_color=False, filter_color=None)[source]#
Returns the sequence of edges of the graph.
- classmethod from_igraph(graph)[source]#
Creates a new Graph instance from an igraph.Graph instance.
- Return type:
- Parameters:
graph (Graph)