Provides a mathematical graph object consisting of vertices
and (directed) edges connecting those vertices. Graphs have
Vertices are specified via id (integer number) and edges via
(tail,head)-tuples
NOTE: ids are supposed to be consecutive and ranging from 0
to G.Order() - 1 !!! Use the labeling to display other numbers
for vertices.
At least one set of edge weights is assumed to exist and accessible
as self.edgeWeights[0]; self.euclidian and Euclidify refer to this
self.edgeWeights[0]
Methods
|
|
|
|
About
|
About ( self )
Return string containing HTML code providing information
about the graph
|
|
AddEdge
|
AddEdge (
self,
tail,
head,
)
Add an edge (tail,head). Returns nothing
Raises GraphNotSimpleError if
- trying to add a loop
- trying to add an edge multiply In case of directed graphs (tail,head) and (head,tail)
are distinct edges
|
|
AddVertex
|
AddVertex ( self )
Add an isolated vertex. Returns the id of the new vertex
|
|
CalculateWidthFromWeight
|
CalculateWidthFromWeight (
self,
scale,
weightID=0,
)
Calculate width of edges (self.edgeWidth will be used by
GraphDisplay if not none) from the specified set of edge
weights. Default: weightID = 0 is used
|
|
DeleteEdge
|
DeleteEdge (
self,
tail,
head,
)
Deletes edge (tail,head). Does not handle undirected graphs
implicitely. Raises NoSuchEdgeError upon error.
|
|
Edge
|
Edge (
self,
tail,
head,
)
Handles undirected graphs by return correct ordered
vertices as (tail,head). Raises NoSuchEdgeError upon error.
|
|
Edges
|
Edges ( self )
Returns all edges
|
|
Euclidify
|
Euclidify ( self )
Replace edge weights with weightID = 0 with Euclidean distance
between incident vertices
|
|
GetNextVertexID
|
GetNextVertexID ( self )
Internal returns next free vertex id
|
|
InEdges
|
InEdges ( self, v )
Returns edges (*,v)
|
|
InNeighbors
|
InNeighbors ( self, v )
Returns vertices w for which (w,v) is an edge
|
|
InOutNeighbors
|
InOutNeighbors ( self, v )
Returns vertices w for which (v,w) or (w,v) is an edge
|
|
IncidentEdges
|
IncidentEdges ( self, v )
Returns edges (v,) and (,v)
|
|
Integerize
|
Integerize ( self, weightID=0 )
Integerize: Make all edge weights integers
|
|
Neighborhood
|
Neighborhood ( self, v )
Returns the vertices which are connected to v. Does handle
undirected graphs (i.e., returns vertices w s.t. either
(v,w) or (w,v) is an edge)
|
|
NrOfEdgeWeights
|
NrOfEdgeWeights ( self )
|
|
NrOfVertexWeights
|
NrOfVertexWeights ( self )
|
|
Order
|
Order ( self )
Returns order i.e., the number of vertices
|
|
OutEdges
|
OutEdges ( self, v )
Returns edges (v,*)
|
|
OutNeighbors
|
OutNeighbors ( self, v )
Returns vertices w for which (v,w) is an edge
|
|
Property
|
Property ( self, name )
Return the value of property name . If the property
name has not been set Unknown is returned
|
|
QDirected
|
QDirected ( self )
Returns 1 if the graph is directed, 0 else
|
|
QEdge
|
QEdge (
self,
tail,
head,
)
Returns 1 if (tail,head) is an edge in G. If G is undirected
order of vertices does not matter
|
|
QEuclidian
|
QEuclidian ( self )
Returns 1 if the graph is euclidian, 0 else
|
|
SetProperty
|
SetProperty (
self,
name,
val,
)
Set the value of property name to val
|
|
Size
|
Size ( self )
Returns size i.e., the number of edge
|
|
Undirect
|
Undirect ( self )
If (u,v) and (v,u) are edges in the directed graph, remove one of them.
to make graph undirected (no multiple edges allowed). Which one gets
deleted depends on ordering in adjacency lists.
|
|
__init__
|
__init__ ( self )
|
|
printMy
|
printMy ( self )
Debugging only
|