Network Types and Interface
Networks in Erdos.jl are graphs with additional ability to store properties associated to vertices, edges and the graph itself. The ready to go network types are the Network
and DiNetwork
types. Custom types con be defined inheriting from ANetwork
and ADiNetwork
abstract types.
Abstract Types
Erdos.ANetwork
— Typeabstract type ANetwork <: AGraph end
An abstract graph with the additional possibility to attach properties to vertices and edges.
Erdos.ADiNetwork
— Typeabstract type ADiNetwork <: ADiGraph end
An abstract directed graph with the additional possibility to attach properties to vertices and edges.
Erdos.AIndexedEdge
— Typeabstract type AIndexedEdge <: AEdge end
Edge types with unique indexes, accessed by idx
Network / DiNetwork / IndexedEdge
Erdos.Network
— TypeNetwork
A type representing a graph with indexed edges and the possibility to store graph/vertex/edge properties.
Network(n=0)
Construct a Network
with n
vertices and no edges.
Network(adjmx::AbstractMatrix; selfedges=true, upper=false)
Construct a Network
from the adjacency matrix adjmx
, placing an edge in correspondence to each nonzero element of adjmx
. If selfedges=false
the diagonal elements of adjmx
are ignored. If upper=true
only the upper triangular part of adjmx
is considered.
Erdos.DiNetwork
— TypeDiNetwork
A type representing a directed graph with indexed edges and the possibility to store graph/vertex/edge properties.
DiNetwork(n=0)
Construct a DiNetwork
with n
vertices and no edges.
DiNetwork(adjmx::AbstractMatrix; selfedges=true)
Construct a DiNetwork
from the adjacency matrix adjmx
. If selfedges=false
the diagonal elements of adjmx
are ignored.
Erdos.IndexedEdge
— Typestruct IndexedEdge <: AIndexedEdge
src::Int
dst::Int
idx::Int
end
An indexed edge type
IndexedEdge(u, v) = IndexedEdge(u,v,-1)
Creates an edge with invalid index.
Defining new network types
In order to define a custom network type, e.g. MyNet <: ANetwork
, the corresponding methods in the preceding paragraph have to be implemented. This is automatically done for custom network types having a props::PropertyStore
member. Take a look to src/factory/network.jl
and src/maps/property_store.jl
for an example.