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 labeled edges where JSON edge ends are represented by node IDs.
Produces a codec for a Graph with 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.
- L
-
the intermediate type of edge labels to be used in
ER. - 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). - 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. - labelCodec
-
codec for
L. - 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 - toLabel
-
function to produce the label for a given edge. Labels are typically of some primitive-like type or tuples. They will be passed to
withNodeReferencesduring encoding. When working with an ADT of edges, edges types might have different labels. To deal with this situation, you need to provide an ADT forLand a separatecasefor every edge type accordingly. - 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)