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.ANetworkType
abstract type ANetwork <: AGraph end

An abstract graph with the additional possibility to attach properties to vertices and edges.

source
Erdos.ADiNetworkType
abstract type ADiNetwork <: ADiGraph end

An abstract directed graph with the additional possibility to attach properties to vertices and edges.

source

Network / DiNetwork / IndexedEdge

Erdos.NetworkType
Network

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.

source
Erdos.DiNetworkType
DiNetwork

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.

source
Erdos.IndexedEdgeType
struct 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.

source

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.