adjacency_from_edges
- compas.topology.adjacency_from_edges(edges)[source]
Construct an adjacency dictionary from a set of edges.
- Parameters
edges (list) – A list of index pairs.
- Returns
dict – A dictionary mapping each index in the list of index pairs to a list of adjacent indices.
Examples
>>> edges = [[0, 1], [0, 2], [0, 3], [0, 4]] >>> adjacency_from_edges(edges) {0: [1, 2, 3, 4], 1: [0], 2: [0], 3: [0], 4: [0]}