compas_3gs.datastructures.Network3gs

class compas_3gs.datastructures.Network3gs[source]

Bases: compas.datastructures.Network

Inherits and extends the compas Network class, such that it is more suitable for 3D graphic statics applications.

Primarily used for polyhedral (and possibly non-polyhedral) form diagrams.

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__()

Initialize self.

add_edge(u, v[, attr_dict])

Add an edge and specify its attributes.

add_vertex([key, attr_dict])

Add a vertex and specify its attributes (optional).

bounding_box()

clear(**kwattr)

Clear all the network data.

clear_edgedict()

Clear only the edges.

clear_edges(**kwattr)

clear_halfedgedict()

Clear only the half-edges.

clear_vertexdict()

Clear only the vertices.

copy()

Make an independent copy of the network object.

datastructure_centroid()

Compute the centroid of the datastructure.

delete_edge(u, v)

Delete an edge from the network.

delete_vertex(key)

Delete a vertex from the network.

draw(**kwattr)

draw_edge_labels(**kwattr)

draw_edges(**kwattr)

draw_vertex_labels(**kwattr)

draw_vertices(**kwattr)

dump(filepath)

Dump the data representing the network to a file using Python’s built-in object serialisation.

dumps()

Dump the data representing the network to a string using Python’s built-in object serialisation.

edge_avg_length()

edge_connected_edges(u, v)

Return the edges connected to an edge.

edge_coordinates(u, v[, axes])

Return the coordinates of the start and end point of an edge.

edge_direction(u, v)

Return the direction vector of an edge.

edge_label_name(u, v)

Get the name of an edge label.

edge_length(u, v)

Return the length of an edge.

edge_midpoint(u, v)

Return the location of the midpoint of an edge.

edge_name(u, v)

Get the name of an edge.

edge_point(u, v[, t])

Return the location of a point along an edge.

edge_vector(u, v[, unitized])

Return the vector of an edge.

edges([data])

Iterate over the edges of the network.

edges_where(conditions[, data])

Get edges for which a certain condition or set of conditions is true.

edges_where_predicate(predicate[, data])

Get edges for which a certain condition or set of conditions is true using a lambda function.

from_data(data)

Construct a datastructure from structured data.

from_json(filepath)

Construct a datastructure from structured data contained in a json file.

from_lines(lines[, precision])

Construct a network from a set of lines represented by their start and end point coordinates.

from_obj(filepath[, precision])

Construct a network from the data contained in an OBJ file.

from_vertices_and_edges(vertices, edges)

Construct a network from vertices and edges.

get_any_edge()

Get the identifier of a random edge.

get_any_vertex()

Get the identifier of a random vertex.

get_any_vertices(n[, exclude_leaves])

Get a list of identifiers of a random set of n vertices.

get_edge_attribute(key, name[, value])

Get the value of a named attribute of one edge.

get_edge_attributes(key, names[, values])

Get the value of a named attribute of one edge.

get_edges_attribute(name[, value, keys])

Get the value of a named attribute of multiple edges.

get_edges_attributes(names[, values, keys])

Get the values of multiple named attribute of multiple edges.

get_vertex_attribute(key, name[, value])

Get the value of a named attribute of one vertex.

get_vertex_attributes(key, names[, values])

Get the value of a named attribute of one vertex.

get_vertices_attribute(name[, value, keys])

Get the value of a named attribute of multiple vertices.

get_vertices_attributes(names[, values, keys])

Get the values of multiple named attribute of multiple vertices.

gkey_key([precision])

Returns a dictionary that maps geometric keys of a certain precision to the keys of the corresponding vertices.

has_edge(u, v[, directed])

Verify if the network contains a specific edge.

has_vertex(key)

Verify if a specific vertex is present in the network.

index_key()

Returns a dictionary that maps the indices of a vertex list to keys in a vertex dictionary.

index_uv()

Returns a dictionary that maps edges in a list to the corresponding vertex key pairs.

is_vertex_connected(key)

Verify if a specific vertex is connected.

is_vertex_leaf(key)

Verify if a vertex is a leaf.

key_gkey([precision])

Returns a dictionary that maps vertex dictionary keys to the corresponding geometric key up to a certain precision.

key_index()

Returns a dictionary that maps vertex dictionary keys to the corresponding index in a vertex list or array.

leaves()

Return all leaves of the network.

load(filepath)

Load serialised network data from a pickle file.

loads(s)

Load serialised network data from a pickle string.

number_of_edges()

Compute the number of edges of the network.

number_of_vertices()

Compute the number of vertices of the network.

plot([vertexcolor, edgecolor, vertexsize, …])

Plot a 2D representation of the network.

set_edge_attribute(key, name, value)

Set one attribute of one edge.

set_edge_attributes(key, names, values)

Set multiple attributes of one edge.

set_edges_attribute(name, value[, keys])

Set one attribute of multiple edges.

set_edges_attributes(names, values[, keys])

Set multiple attributes of multiple edges.

set_vertex_attribute(key, name, value)

Set one attribute of one vertex.

set_vertex_attributes(key, names, values)

Set multiple attributes of one vertex.

set_vertices_attribute(name, value[, keys])

Set one attribute of multiple vertices.

set_vertices_attributes(names, values[, keys])

Set multiple attributes of multiple vertices.

split_edge(u, v[, t])

Split and edge by inserting a vertex along its length.

summary()

Print a summary of the mesh.

to_data()

Returns a dictionary of structured data representing the data structure.

to_json(filepath[, pretty])

Serialise the structured data representing the data structure to json.

to_lines([axes])

Return the lines of the network as pairs of start and end point coordinates.

to_obj()

Write the network to an OBJ file.

to_points([axes])

Return the coordinates of the network.

to_vertices_and_edges()

Return the vertices and edges of a network.

update_default_edge_attributes([attr_dict])

Update the default edge attributes (this also affects already existing edges).

update_default_vertex_attributes([attr_dict])

Update the default vertex attributes (this also affects already existing vertices).

uv_index()

Returns a dictionary that maps edge keys (i.e.

vertex_connected_edges(key)

Return the edges connected to a vertex.

vertex_coordinates(key[, axes])

Return the coordinates of a vertex.

vertex_degree(key)

Return the number of neighbors of a vertex.

vertex_degree_in(key)

Return the numer of incoming neighbors of a vertex.

vertex_degree_out(key)

Return the number of outgoing neighbors of a vertex.

vertex_label_name(key)

Get the name of a vertex label.

vertex_laplacian(key)

Return the vector from the vertex to the centroid of its 1-ring neighborhood.

vertex_max_degree()

Compute the maximum degree of all vertices.

vertex_min_degree()

Compute the minimum degree of all vertices.

vertex_name(key)

Get the name of a vertex.

vertex_neighborhood(key[, ring])

Return the vertices in the neighborhood of a vertex.

vertex_neighborhood_centroid(key)

Compute the centroid of the neighboring vertices.

vertex_neighbors(key)

Return the neighbors of a vertex.

vertex_neighbors_in(key)

Return the incoming neighbors of a vertex.

vertex_neighbors_out(key)

Return the outgoing neighbors of a vertex.

vertex_update_xyz(vkey, new_xyz[, constrained])

vertices([data])

Iterate over the vertices of the network.

vertices_where(conditions[, data])

Get vertices for which a certain condition or set of conditions is true.

vertices_where_predicate(predicate[, data])

Get vertices for which a certain condition or set of conditions is true using a lambda function.

Attributes

adjacency

Alias for the halfedge attribute.

data

Return a data dict of this data structure for serialisation.

name

str – The name of the data structure.