GraphCodec
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
GraphCodec.type
Members list
Type members
Inherited and Abstract classlikes
Attributes
- Inherited from:
- IdBasedGraphCodec (hidden)
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Produces a codec for a Graph with non-labeled edges where JSON edge ends are represented by node IDs.
Produces a codec for a Graph with non-labeled edges where JSON edge ends are represented by node IDs.
Replacing edge ends by node IDs facilitates a more compact JSON representation. This is because nodes are encoded into an array of nodes so edges, that get encoded into a separate array, do not need to also embed complete nodes. Therefore, prefer this Graph codec over embedded nodes unless nodes are of some primitive-like type.
For edges, this codec uses the predefined ADT WithNodeReferences which is an intermediate JSON representation of edges with edge ends of type N replaced by node IDs of type Id.
Type parameters
- E
-
the type of edges.
- ER
-
the type of the JSON representation of edges with edge ends of type
Id. - G
-
the type of Graph.
- Id
-
the type of node IDs constrained to primitive-like types.
- N
-
the type of nodes.
Value parameters
- config
-
to be passed to the Graph after JSON decoding. Use
GraphCodec.graphConfigto produce your best-guess configuration. - diHyperEdgeFactory
-
to produce directed hyperedges from JSON. Provide separate
cases for all used directed hyperedge types. - edgeFactory
-
to produce edges from JSON. Provide separate
cases for all used edge types. The first,Stringmember of the tuple corresponds to theedgeTparameter of the intermediate*WithNodeReferencesclass. - edgeWithNodeReferencesCodec
-
codec for the intermediate JSON edge type
ER. UseJsonCodecMaker.maketo create this codec. In case you are using one of the ADTsAny*WithNodeReferences, the JSON will also include the concrete type like"type": "DiEdgeWithNodeReferences". You can replace these verbose class names by shortcuts by invoking the macro likeJsonCodecMaker.make(compactClassNames). - exclude
-
causes a compile error if edges have the superclass
SingleLabel. Note that this is just a partial check since there exists no ultimate library abstraction for labeled classes. - factory
-
to create the Graph from the decoded JSON based on
Iterables of nodes and edges. Typically, you can passGraph.from(_, _)(_)whereGraphis either mutable or immutable. - hyperEdgeFactory
-
to produce hyperedges from JSON. Provide separate
cases for all used hyperedge types. - id
-
a one-to-one function producing an ID for a given node.
- idCodec
-
codec for
Id. - nodeCodec
-
codec for
N. - onJsonNull
-
is used in case the complete JSON is
null. Either supply a default, usually empty, Graph ornull.asInstanceOf[...]to let thenullcase fail. See also JsonValueCodec.nullValue - withNodeReferences
-
factory for the JSON representation of edges. Just supply the appropriate predefined factory like
DiEdgeWithNodeReferences.apply. The predefined factories also support mixed Graphs.
Attributes
Inherited methods
Produces an optimal Graph configuration for the purpose of reducing internal memory allocations.
Produces an optimal Graph configuration for the purpose of reducing internal memory allocations.
Value parameters
- degreeHint
-
edge degree with a high percentile.
- orderHint
-
number of nodes in the Graph with a high percentile.
Attributes
- Inherited from:
- GraphCodec (hidden)
Inherited fields
The key of the array of edges in the JSON.
The key of the array of edges in the JSON.
Attributes
- Inherited from:
- GraphCodec (hidden)
The key of the array of nodes in the JSON.
The key of the array of nodes in the JSON.
Attributes
- Inherited from:
- GraphCodec (hidden)