Base
Nodes and Edges
Node and edge types and functions.
EvolvingGraphs.AbstractNode
— Type.AbstractNode{V}
Abstract supertype for all node types, where V
is the type of the node key.
EvolvingGraphs.node_index
— Function.node_index(v)
node_index(g::AbstractGraph, v)
Return the index of a node v
.
EvolvingGraphs.node_key
— Function.node_key(v)
Return the key of a node v
.
EvolvingGraphs.Node
— Type.Node(index, key)
Node{V}(key)
Node{V}(g, key)
Constructs a Node with node index index
of type V
and key value key
. If only key
is given, set index
to 0
. Node(g, key) constructs a new node in graph g
, so index is equal to num_nodes(g) + 1
.
Example
julia> using EvolvingGraphs
julia> a = Node(1,"a")
Node(a)
julia> node_index(a)
1
julia> node_key(a)
"a"
julia> b = Node{String}("b")
Node(b)
julia> node_index(b)
0
EvolvingGraphs.AttributeNode
— Type.AttributeNode(index, key, attributes=Dict())
AttributeNode{K, D_k, D_v}(key, attributes=Dict())
AttributeNode{K, D_k, D_v}(g, key, attributes=Dict())
Construct an AttributeNode with index index
, key value key
and attributes attributes
. If index
is not given, set index = 0
. AttributeNode(g, key, attributes)
constructs a new AttributeNode for graph g
, where index = num_nodes(g) + 1
.
Example
julia> using EvolvingGraphs
julia> a = AttributeNode(1, "a", Dict("a" => 12))
AttributeNode(a)
julia> node_key(a)
"a"
julia> node_index(a)
1
julia> node_attributes(a)
Dict{String,Int64} with 1 entry:
"a" => 12
EvolvingGraphs.node_attributes
— Function.node_attributes(v)
node_attributes(v, g::AbstractGraph)
Returns the attributes of AttributeNode v
.
EvolvingGraphs.TimeNode
— Type.TimeNode(index, key, timestamp)
TimeNode{V,T}(key, timestamp)
TimeNode{V,T}(g, key, timestamp)
Constructs a TimeNode at timestamp timestamp
. TimeNode(g, key, timestamp)
constructs a TimeNode in graph g
.
Example
julia> using EvolvingGraphs
julia> t = TimeNode(1, "t", 2018)
TimeNode(t, 2018)
julia> node_index(t)
1
julia> node_key(t)
"t"
julia> node_timestamp(t)
2018
EvolvingGraphs.node_timestamp
— Function.node_timestamp(v)
Return the timestamp of TimeNode v
.
EvolvingGraphs.AbstractEdge
— Type.AbstractEdge{V}
Abstract supertype for all edge types, where V
represents the type of the source and target nodes.
EvolvingGraphs.source
— Function.source(e)
Return the source of edge e
.
EvolvingGraphs.target
— Function.target(e)
Return the target of edge e
.
EvolvingGraphs.edge_timestamp
— Function.edge_timestamp(e)
Return the timestamp of edge e
if e
is a time dependent edge, i.e., TimeEdge
or WeightedTimeEdge
.
Example
julia> using EvolvingGraphs
julia> e1 = TimeEdge("A", "B", 1)
A->B at time 1
julia> edge_timestamp(e1)
1
julia> a = Edge(1, 2)
1->2
julia> edge_timestamp(a)
ERROR: type Edge has no field timestamp
[...]
EvolvingGraphs.Edge
— Type.Edge(source, target)
Construct an Edge from a source node and a target node.
EvolvingGraphs.edge_reverse
— Function.edge_reverse(e)
Return the reverse of edge e
, i.e., source is now target and target is now source.
EvolvingGraphs.TimeEdge
— Type.TimeEdge(source, target, timestamp)
Construct a TimeEdge with source node source
, target node target
at time stamp timestamp
.
EvolvingGraphs.WeightedTimeEdge
— Type.WeightedTimeEdge(source, target, weight, timestamp)
WeightedTimeEdge(source, target, timestamp)
Construct a WeightedTimeEdge. if weight
is not given, set weight = 1.0
.
EvolvingGraphs.edge_weight
— Function.edge_weight(e)
Returns the edge weight of a WeightedTimeEdge e
.
EvolvingGraphs.has_node
— Function.has_node(e, v)
has_node(g, v)
In the first case, return true
if v
is a node of the edge e
. In the second case, return true
if graph g
contains node v
and false
otherwise, where v
can a node type object or a node key.
Paths
Path types and functions.
EvolvingGraphs.AbstractPath
— Type.AbstractPath
Abstract supertype for all path types.
EvolvingGraphs.TemporalPath
— Type.TemporalPath()
Construct a TemporalPath, i.e., an array of TimeNode.
Example
julia> using EvolvingGraphs
julia> p = TemporalPath()
julia> push!(p, TimeNode(1, "a", 2001))
TimeNode(a, 2001)
julia> push!(p, TimeNode(1, "b", 2002))
TimeNode(a, 2001)->TimeNode(b, 2002)
julia> p
TimeNode(a, 2001)->TimeNode(b, 2002)
julia> append!(p,p)
TimeNode(a, 2001)->TimeNode(b, 2002)->TimeNode(a, 2001)->TimeNode(b, 2002)