neighbours(graph, *args, **kwargs)¶
Yield all nodes to which there is an outgoing edge from
- graph (
Graph) – graph in which to search for edges
- node – node from which edges originate.
- maximum_distance – maximum distance to other nodes
iterator of neighbour nodes
NodeError – if
nodeis not in the graph
None, it is the maximum allowed edge value. This is interpreted using the
graph[edge] <= distance.
If there is a valid edge
graph[node:node] <= distance, then
nodeis part of its own neighbourhood.
Note: The order of neighbours is arbitrary.
- graph (
density(graph, *args, **kwargs)¶
Return the density of the graph, i.e. the connectedness of its nodes
Parameters: graph (
Graph) – graph for which to calculate density
Raises: ValueError – if
graphhas no nodes
The density is the ratio of actual edge count versus the maximum, non-looping edge count.
A graph without edges has a density of
0, whereas a complete graph has a density of
1. A graph with a loop may have a density bigger than
1. The density is undefined for a graph less than two nodes, and raises