Edges

s3dgraphy.edges.edge.get_connections_datamodel(datamodel_path: str | None = None) ConnectionsDatamodel[source]

Get the global ConnectionsDatamodel instance.

This function implements a singleton pattern for efficient reuse.

Parameters:

datamodel_path – Optional path to the connections datamodel JSON file. Only used on first call.

Returns:

The global ConnectionsDatamodel instance

class s3dgraphy.edges.edge.Edge(edge_id, edge_source, edge_target, edge_type)[source]

Bases: object

Represents an edge in the graph, connecting two nodes with a specific relationship type.

edge_id

Unique identifier for the edge.

Type:

str

edge_source

ID of the source node.

Type:

str

edge_target

ID of the target node.

Type:

str

edge_type

Semantic type of the relationship.

Type:

str

label

A descriptive label for the relationship type.

Type:

str

description

A detailed description of the relationship type.

Type:

str

__init__(edge_id, edge_source, edge_target, edge_type)[source]
to_dict()[source]

Converts the Edge instance to a dictionary format.

Returns:

A dictionary representation of the edge, including its attributes.

Return type:

dict

__repr__()[source]

Returns a string representation of the Edge instance.

Returns:

A string representation of the edge, showing its source, target, and type.

Return type:

str

is_symmetric()[source]

Check if this edge is symmetric (bidirectional).

is_canonical()[source]

Check if this edge uses the canonical direction.

get_reverse_name()[source]

Get the reverse edge name if this edge has directionality.

static get_datamodel()[source]

Get the global connections datamodel instance.

Edge Types Dictionary

s3dgraphy.edges.edge.EDGE_TYPES

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

The EDGE_TYPES dictionary contains all valid edge types with their labels and descriptions.