pyfibre.model.core.base_graph module

class pyfibre.model.core.base_graph.BaseGraph(graph=None)[source]

Bases: pyfibre.model.core.base_pyfibre_object.BasePyFibreObject

Container for a Networkx Graph representing a connected fibrous region on an image

add_edge(*args, **kwargs)[source]

Add edge to Networkx graph attribute

add_node(*args, **kwargs)[source]

Add node to Networkx graph attribute

classmethod from_array(array, **kwargs)[source]

Deserialises numpy array to return an instance of the class

classmethod from_json(data)[source]

Routine to represent any instance as a dictionary containing basic python data types

property node_coord

Helper routine to return a numpy array of pixel coordinates of each node in the networkx graph.

property node_list

Helper routine to return a list of node labels in the networkx graph

property number_of_edges

Extends networkx API to obtain number of edges

property number_of_nodes

Extends networkx API to obtain number of nodes

to_array(**kwargs)[source]

Serialises instance into a numpy array able to be dumped as a numpy binary file

to_json()[source]

Return the object state in a form that can be serialised as a JSON file