Graph.create constructor

Graph.create({
  1. String? id,
  2. GraphType type = GraphType.graph,
  3. bool strict = false,
  4. required Map<String, List<String>> data,
})

Create a graph from a mapping of node to connected nodes.

Implementation

factory Graph.create({
  String? id,
  GraphType type = GraphType.graph,
  bool strict = false,
  required Map<String, List<String>> data,
}) =>
    Graph(
      id: id,
      stmtList: StmtList(dataToStatements(
        data,
        type == GraphType.graph ? EdgeOp.directed : EdgeOp.undirected,
      )),
      strict: strict,
      type: type,
    );