GraphCodec

scalax.collection.io.jsoniter.GraphCodec
object GraphCodec

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
GraphCodec.type

Members list

Value members

Concrete methods

def withEmbeddedNodes[N, E <: Edge[N], G <: ([X, Y <: Edge[X]] =>> AnyGraph[X, Y])](factory: (Iterable[N], Iterable[E], GraphConfig) => G[N, E], config: GraphConfig, onJsonNull: => G[N, E])(using nodeCodec: JsonValueCodec[N], edgeCodec: JsonValueCodec[E]): JsonValueCodec[G[N, E]]

Produces a Graph codec with a JSON where edge ends are represented by the full JSON of N.

Produces a Graph codec with a JSON where edge ends are represented by the full JSON of N.

This codec is the right choice whenever N is a primitive-like type, including all primitive types, String, or any type with a fairly small JSON representation. Further, you might opt for this codec, even if N should be more complex, provided you are NOT concerned about the total length of the JSON. For instance, the resulting verbose edge ends might add value in an educational environment.

Value parameters

config

to be passed to the Graph after JSON decoding. Use GraphCodec.graphConfig to produce your best-guess configuration.

edgeCodec

codec for E. If E is a concrete class or an ADT of edges, use JsonCodecMaker.make directly. For mixed Graphs with an E being AnyEdge[N] or alike, where your concrete edge classes do not build an ADT, refer to EdgeCodec.makePolymorphicWithEmbeddedNodes.

factory

to create the Graph from the decoded JSON based on Iterables of nodes and edges. Typically, you can pass Graph.from(_, _)(_) where Graph is either mutable or immutable.

nodeCodec

codec for N.

onJsonNull

is used in case the complete JSON is null. Either supply a default, usually empty, Graph or null.asInstanceOf[...] to let the null case fail. See also JsonValueCodec.nullValue

Attributes

Inherited methods

def graphConfig(orderHint: Int, degreeHint: Int): GraphConfig

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

val Edges: String

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)
val Nodes: String

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)