Network
- class compas.datastructures.Network(name=None, default_node_attributes=None, default_edge_attributes=None)[source]
Bases:
compas.datastructures.graph.graph.Graph
Geometric implementation of an edge graph.
- Parameters
name (str, optional) – The name of the graph. Defaults to “Graph”.
default_node_attributes (dict, optional) – Default values for node attributes.
default_edge_attributes (dict, optional) – Default values for edge attributes.
Inherited Attributes
DATASCHEMA
The schema of the data of this object.
JSONSCHEMA
The schema of the JSON representation of the data of this object.
JSONSCHEMANAME
data
Return a data dict of this data structure for serialization.
dtype
The type of the object in the form of a '2-level' import and a class name.
guid
The globally unique identifier of the object.
jsondefinitions
Reusable schema definitions.
jsonstring
The representation of the object data in JSON format.
jsonvalidator
JSON schema validator for draft 7.
name
The name of the data structure.
Methods
Creates a node adjacency matrix from a Network datastructure.
Generate the complement network of a network.
Creates a connectivity matrix from a Network datastructure.
Count the number of crossings (pairs of crossing edges) in the network.
Creates a node degree matrix from a Network datastructure.
Return the coordinates of the start and end point of an edge.
Return the direction vector of an edge.
Return the length of an edge.
Return the location of the midpoint of an edge.
Return the location of a point along an edge.
Return the vector of an edge.
Embed the network in the plane.
Identify all pairs of crossing edges in a network.
Find the faces of a network.
Construct a network from a set of lines represented by their start and end point coordinates.
Construct a network from nodes and edges.
Construct a network from the data contained in an OBJ file.
Returns a dictionary that maps geometric keys of a certain precision to the keys of the corresponding nodes.
Returns a dictionary that maps geometric keys of a certain precision to the keys of the corresponding nodes.
Verify that the network is connected.
Verify if a network has crossing edges.
Check if the network is planar.
Verify that a network is embedded in the plane without crossing edges.
Verify that a network lies in the XY plane.
Returns a dictionary that maps node dictionary keys to the corresponding geometric key up to a certain precision.
Construct a Laplacian matrix from a Network datastructure.
Creates a node adjacency matrix from a Network datastructure.
Creates a connectivity matrix from a Network datastructure.
Creates a node degree matrix from a Network datastructure.
Embed the network in the plane.
Check if the network is planar.
Verify that a network is embedded in the plane without crossing edges.
Construct a Laplacian matrix from a Network datastructure.
Return the coordinates of a node.
Returns a dictionary that maps node dictionary keys to the corresponding geometric key up to a certain precision.
Return the vector from the node to the centroid of its 1-ring neighborhood.
Compute the centroid of the neighboring nodes.
Find the shortest path between two nodes of the network.
Smooth a network by moving every free node to the centroid of its neighbors.
Split and edge by inserting a node along its length.
Return the lines of the network as pairs of start and end point coordinates.
Return the nodes and edges of a network.
Write the network to an OBJ file.
Return the coordinates of the network.
Transform a network.
Transform a copy of
network
.Inherited Methods
Add an edge and specify its attributes.
Add a node and specify its attributes (optional).
Clear all the network data.
Return the edges connected to a node.
Make an independent copy of the data object.
Return the number of neighbors of a node.
Return the numer of incoming neighbors of a node.
Return the number of outgoing neighbors of a node.
Delete an edge from the network.
Delete a node from the graph.
Get or set an attribute of an edge.
Get or set multiple attributes of an edge.
Get the identifiers of a set of random edges.
Iterate over the edges of the network.
Get or set an attribute of multiple edges.
Get or set multiple attributes of multiple edges.
Get edges for which a certain condition or set of conditions is true.
Get edges for which a certain condition or set of conditions is true using a lambda function.
Construct an object of this type from the provided data.
Construct an object from serialized data contained in a JSON file.
Construct an object from serialized data contained in a JSON string.
Create a new graph instance from a NetworkX DiGraph instance.
Get the identifier of a random edge.
Get the identifiers of a set of random edges.
Get the identifier of a random node.
Get a list of identifiers of a random set of n nodes.
Verify if the network contains a specific edge.
Verify if a specific node is present in the network.
Returns a dictionary that maps the indices of a node list to keys in a node dictionary.
Returns a dictionary that maps edges in a list to the corresponding vertex key pairs.
Verify if a node is a leaf.
Verify if a specific node is connected.
Returns a dictionary that maps node dictionary keys to the corresponding index in a node list or array.
Return all leaves of the network.
Return the nodes in the neighborhood of a node.
Return the neighbors of a node.
Return the incoming neighbors of a node.
Return the outgoing neighbors of a node.
Get or set an attribute of a node.
Get or set multiple attributes of a node.
Get a list of identifiers of a random set of n nodes.
Iterate over the nodes of the network.
Get or set an attribute of multiple nodes.
Get or set multiple attributes of multiple nodes.
Get nodes for which a certain condition or set of conditions is true.
Get nodes for which a certain condition or set of conditions is true using a lambda function.
Compute the number of edges of the network.
Compute the number of nodes of the network.
Print a summary of the graph.
Convert an object to its native data representation.
Serialize the data representation of an object to a JSON file.
Serialize the data representation of an object to a JSON string.
Create a new NetworkX graph instance from a graph.
Unset the attribute of an edge.
Unset the attribute of a node.
Update the default edge attributes.
Update the default edge attributes.
Update the default node attributes.
Update the default node attributes.
Returns a dictionary that maps edge keys (i.e.
Validate the object's data against its data schema (self.DATASCHEMA).
Validate the object's data against its json schema (self.JSONSCHEMA).