addRemoveEdges: addRemoveEdges(graphAddRemove)

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This method reads edges from either a matrix or a file and adds or removes them to/from the graph.

Usage

1
2
3
DynComm.addRemoveEdges(dyncomm,graphAddRemove)
DynComm.addRemove(dyncomm,graphAddRemove)
DynComm.add(dyncomm,graphAddRemove)

Arguments

dyncomm

A DynComm object, if not using the inline version of the function call

graphAddRemove

Either the matrix or the filename that contains the edges to add/remove

Details

If the weight is exactly zero, the edge is removed from the graph.

If a vertex, mentioned in the source or destination, does not exist it will be added to the graph.

If any post processing algorithm exists, it is automatically calculated after the main algorithm.

Matrix input

The matrix must have at least two columns with the source and destination vertices.

If all edges are to be added with the default weight, a third column is optional.

If any edge is to be removed, the third column is mandatory.

File input

The file must have only one edge per line, with values separated by a white space (both SPACE and TAB work in any amount and combination). The line must end with a newline character (also known as linefeed, LF or '\n').

The first value is the source vertex, the second is the destination vertex, and the third is the weight.

The weight can be ommited if the edge is to be added using the default weight of 1 (one), or if the parameter to ignore weights was set.

The method detects automatically if the weight is present on a row by row basis so some rows may have weights defined and others not.

Value

FALSE if any kind of error occurred. Otherwise, TRUE

Author(s)

poltergeist0

See Also

DynComm , postProcess

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(DynComm)
Parameters<-matrix(c("e","0.1","w", "FALSE"),ncol=2, byrow=TRUE)
dc<-DynComm(ALGORITHM$LOUVAIN,CRITERION$MODULARITY,Parameters)
#adding edges with the use of a matrix
dc$addRemoveEdges(
 matrix(
   c(10,20,10,30,20,30,30,60,40,60,40,50,50,70,60,70)
   ,ncol=2,byrow=TRUE)
)

dc<-DynComm(ALGORITHM$LOUVAIN,CRITERION$MODULARITY,Parameters)
#adding edges with the use of a file
dc$addRemoveEdges(system.file("extdata","graphAddRemoveFile.txt",package = "DynComm"))

DynComm documentation built on Oct. 23, 2020, 5:57 p.m.