C# Class Brunet.Graph.Graph

Graph provides the ability to test routing algorithms for ring-based structured p2p networks
Key features provided by Graph include support for Tunnels, latency, hop count, user specified latency, tweaking of network size, near neighbor count, shortcut count.
Show file Open project: pstjuste/brunet Class Usage Examples

Protected Properties

Property Type Description
_addr_to_index int>.Dictionary
_addr_to_node GraphNode>.Dictionary
_addrs List
_latency_map List>
_rand System.Random

Public Methods

Method Description
AllToAll ( ) : void
Average ( List data ) : double

Calculates the average of a data set.

BoundedBroadcast ( AHAddress caller, AHAddress from, AHAddress to ) : int

Performs the bounded broadcast using recursion.

Broadcast ( ) : int

Performs a broadcast to the entire overlay.

Broadcast ( AHAddress from ) : int

Performs a broadcast to the entire overlay.

BroadcastAverage ( ) : void
Crawl ( ) : void

Crawls the network using a random address in the network.

Crawl ( AHAddress start ) : void

Crawls the network using the given starting address.

DhtQuery ( AHAddress from, byte key ) : int
GetLeftNearTarget ( AHAddress address ) : AHAddress

Calculate the Left AHAddress of the given address.

GetNearTarget ( AHAddress address ) : AHAddress
Graph ( int count, int near, int shortcuts ) : Brunet.Collections
Graph ( int count, int near, int shortcuts, int seed ) : Brunet.Collections
Graph ( int count, int near, int shortcuts, int random_seed, List dataset ) : Brunet.Collections
ReadLatencyDataSet ( string dataset ) : List>

Loads a square matrix based latency data set from a file.

SendPacket ( AHAddress from, AHAddress to ) : List

Sends a packet from A to B returning the delay and hop count using the Greedy Routing Algorithm.

SendPacket ( AHAddress from, AHAddress to, ushort option ) : List

Sends a packet from A to B returning the delay and hop count.

StandardDeviation ( List data, double avg ) : double

Calculates the standard deviation given a data set and the average.

WriteGraphFile ( string outfile ) : void

Creates a Dot file which can generate an image using either neato with using the -n parameter or circo.

Protected Methods

Method Description
AddConnection ( GraphNode node1, GraphNode node2, int delay ) : void

Creates an edge and a connection from node2 to node1 including the edge. Note: this is unidirectional, this must be called twice, swapping node1 with node2 for a connection to be complete.

CalculateDelay ( GraphNode node1, GraphNode node2 ) : int

Calculates the delay between two nodes.

ComputeShortcutTarget ( AHAddress addr ) : AHAddress

Calculates a shortcut using a harmonic distribution as in a Symphony-lke shortcut.

CreateNode ( AHAddress addr ) : GraphNode

Let the inheritor create their own node types

FindNodeNearestToAddress ( AHAddress addr ) : AHAddress
FixLists ( ) : void
GenerateAddress ( ) : AHAddress
MapToRing ( byte key ) : Brunet.Util.MemBlock[]

Method Details

AddConnection() protected method

Creates an edge and a connection from node2 to node1 including the edge. Note: this is unidirectional, this must be called twice, swapping node1 with node2 for a connection to be complete.
protected AddConnection ( GraphNode node1, GraphNode node2, int delay ) : void
node1 GraphNode
node2 GraphNode
delay int
return void

AllToAll() public method

public AllToAll ( ) : void
return void

Average() public static method

Calculates the average of a data set.
public static Average ( List data ) : double
data List
return double

BoundedBroadcast() public method

Performs the bounded broadcast using recursion.
public BoundedBroadcast ( AHAddress caller, AHAddress from, AHAddress to ) : int
caller AHAddress
from AHAddress
to AHAddress
return int

Broadcast() public method

Performs a broadcast to the entire overlay.
public Broadcast ( ) : int
return int

Broadcast() public method

Performs a broadcast to the entire overlay.
public Broadcast ( AHAddress from ) : int
from AHAddress
return int

BroadcastAverage() public method

public BroadcastAverage ( ) : void
return void

CalculateDelay() protected method

Calculates the delay between two nodes.
protected CalculateDelay ( GraphNode node1, GraphNode node2 ) : int
node1 GraphNode
node2 GraphNode
return int

ComputeShortcutTarget() protected method

Calculates a shortcut using a harmonic distribution as in a Symphony-lke shortcut.
protected ComputeShortcutTarget ( AHAddress addr ) : AHAddress
addr AHAddress
return AHAddress

Crawl() public method

Crawls the network using a random address in the network.
public Crawl ( ) : void
return void

Crawl() public method

Crawls the network using the given starting address.
public Crawl ( AHAddress start ) : void
start AHAddress
return void

CreateNode() protected method

Let the inheritor create their own node types
protected CreateNode ( AHAddress addr ) : GraphNode
addr AHAddress
return GraphNode

DhtQuery() public method

public DhtQuery ( AHAddress from, byte key ) : int
from AHAddress
key byte
return int

FindNodeNearestToAddress() protected method

protected FindNodeNearestToAddress ( AHAddress addr ) : AHAddress
addr AHAddress
return AHAddress

FixLists() protected method

protected FixLists ( ) : void
return void

GenerateAddress() protected method

protected GenerateAddress ( ) : AHAddress
return AHAddress

GetLeftNearTarget() public method

Calculate the Left AHAddress of the given address.
public GetLeftNearTarget ( AHAddress address ) : AHAddress
address AHAddress
return AHAddress

GetNearTarget() public method

public GetNearTarget ( AHAddress address ) : AHAddress
address AHAddress
return AHAddress

Graph() public method

public Graph ( int count, int near, int shortcuts ) : Brunet.Collections
count int
near int
shortcuts int
return Brunet.Collections

Graph() public method

public Graph ( int count, int near, int shortcuts, int seed ) : Brunet.Collections
count int
near int
shortcuts int
seed int
return Brunet.Collections

Graph() public method

public Graph ( int count, int near, int shortcuts, int random_seed, List dataset ) : Brunet.Collections
count int The network size not including the clusters.
near int The amount of connections on the left or right of a ///node.
shortcuts int The amount of far connections had per node.
random_seed int
dataset List A square dataset consisting of pairwise latencies.
return Brunet.Collections

MapToRing() protected method

protected MapToRing ( byte key ) : Brunet.Util.MemBlock[]
key byte
return Brunet.Util.MemBlock[]

ReadLatencyDataSet() public static method

Loads a square matrix based latency data set from a file.
public static ReadLatencyDataSet ( string dataset ) : List>
dataset string
return List>

SendPacket() public method

Sends a packet from A to B returning the delay and hop count using the Greedy Routing Algorithm.
public SendPacket ( AHAddress from, AHAddress to ) : List
from AHAddress
to AHAddress
return List

SendPacket() public method

Sends a packet from A to B returning the delay and hop count.
public SendPacket ( AHAddress from, AHAddress to, ushort option ) : List
from AHAddress
to AHAddress
option ushort
return List

StandardDeviation() public static method

Calculates the standard deviation given a data set and the average.
public static StandardDeviation ( List data, double avg ) : double
data List
avg double
return double

WriteGraphFile() public method

Creates a Dot file which can generate an image using either neato with using the -n parameter or circo.
public WriteGraphFile ( string outfile ) : void
outfile string
return void

Property Details

_addr_to_index protected property

protected Dictionary _addr_to_index
return int>.Dictionary

_addr_to_node protected property

protected Dictionary _addr_to_node
return GraphNode>.Dictionary

_addrs protected property

protected List _addrs
return List

_latency_map protected property

protected List> _latency_map
return List>

_rand protected property

protected Random,System _rand
return System.Random