getCosts | R Documentation |
The function getCosts
returns the costs associated to the edges of a
gGraph object using different possible outputs. These outputs
are designed to match possible outputs of getEdges
function.
getCosts(x, ...)
## S4 method for signature 'gGraph'
getCosts(x, res.type = c("asIs", "vector"), unique = FALSE, ...)
getNodeCosts(x, ...)
## S4 method for signature 'gGraph'
getNodeCosts(x, attr.name, ...)
x |
a valid gGraph. |
... |
other arguments passed to other methods (currently unused). |
res.type |
a character string indicating which kind of output should be used. See value. |
unique |
a logical indicating whether the costs should be returned for unique edges (TRUE), or if duplicate edges should be considered as well (TRUE, default). |
attr.name |
the name of the node attribute used to define node costs. |
getNodeCosts
returns the costs associated to nodes based on one node
attribute.
The notion of 'costs' in the context of gGraph objects is identical to the concept of 'weights' in graph (and thus graphNEL) objects. The larger it is for an edge, the less connectivity there is between the couple of concerned nodes.
The output depends on the value of the argument res.type
:
asIs
: output is a named list of weights, each slot containing
weights associated to the edges stemming from one given node. This format is
that of the weights
accessor for graphNEL objects.
vector
: a vector of weights; this output matches matrix outputs of
getEdges
.
getCosts(gGraph)
: Method for gGraph object
getNodeCosts()
: Function to get the costs values for nodes
getNodeCosts(gGraph)
: Method to get node costs for gGraph object
Most other accessors are documented in gGraph
manpage.
head(getEdges(worldgraph.10k, res.type = "matNames", unique = TRUE))
head(getCosts(worldgraph.10k, res.type = "vector", unique = TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.