kwant.graph.
Graph
¶Bases: object
An uncompressed graph. Used to make compressed graphs. (See CGraph
.)
Methods
add_edge
()¶Add the directed edge (tail, head) to the graph.
Parameters:  tail : integer head : integer 

Returns:  edge_nr : integer

Raises:  ValueError

add_edges
()¶Add multiple edges in one pass.
Parameters:  edges : iterable of 2sequences of integers


Returns:  first_edge_nr : integer

compressed
()¶Build a CGraph from this graph.
Parameters:  twoway : boolean (default: False)
edge_nr_translation : boolean (default: False)
allow_lost_edges : boolean (default: False)


Raises:  ValueError

Notes
In a oneway compressed graph, an edge with a negative tail is present only minimally: it is only possible to query the head of such an edge, given the edge ID. This is why oneway compression of a graph with a negative tail leads to a ValueError being raised, unless allow_lost_edges is true.
reserve
()¶Reserve space for edges.
Parameters:  capacity : integer


Notes
It is not necessary to call this method, but using it can speed up the creation of graphs.
write_dot
()¶Write a representation of the graph in dot format to file.
That resulting file can be visualized with dot(1) or neato(1) form the graphviz package.
Attributes
num_nodes
¶