Skip to content

grafeo.Edge

Represents a graph edge.

Properties

Property Type Description
id int Internal edge ID
type str Edge type
source int Source node ID
target int Target node ID

Methods

get()

Get a property value.

def get(self, key: str, default: Any = None) -> Any

keys()

Get all property keys.

def keys(self) -> List[str]

Example

with db.session() as session:
    result = session.execute("""
        MATCH (a)-[r:KNOWS]->(b)
        RETURN r LIMIT 1
    """)
    row = next(iter(result))
    edge = row['r']

    print(f"Type: {edge.type}")
    print(f"From: {edge.source} To: {edge.target}")
    print(f"Since: {edge.get('since')}")