Edge class abstract

Abstract base class for edges in the graph database.

An edge represents a connection between two nodes in the graph. All edges must have a source node (from), a target node (to), and a weight value. Implement this class to create custom edge types for your graph database.

Example:

class FriendshipEdge extends Edge {
  @override
  final String from;

  @override
  final String to;

  @override
  final double weight;

  FriendshipEdge({
    required this.from,
    required this.to,
    this.weight = 1.0,
  });

  @override
  Map<String, dynamic> toJson() {
    return {
      'from': from,
      'to': to,
      'weight': weight,
    };
  }
}

Constructors

Edge()

Properties

from String
The ID of the source node this edge originates from.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
to String
The ID of the target node this edge points to.
no setter
weight double
The weight of this edge, typically used for graph algorithms.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this edge to a JSON representation.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited