Skip to content

Node order missing#18

Merged
iankloo merged 2 commits into
iankloo:developmentfrom
aj2duncan:node_order_missing
Jun 14, 2018
Merged

Node order missing#18
iankloo merged 2 commits into
iankloo:developmentfrom
aj2duncan:node_order_missing

Conversation

@aj2duncan

Copy link
Copy Markdown
Contributor

…h no edges.

This is an updated version of #17

What my pull fixes (if applicable)

#15

What my pull improves (if applicable)

It allows nodes to have no connections. As these don't appear in the edges data frame they won't be created in tmp_graph.

Confirmation that you have tested your code

Example of test code below, although I have also used other graphs. There can be small rounding errors but I haven't had any mismatches down to 10^(-12).

library(sigmaNet)
library(igraph)

data = lesMis

sigmaObj = sigmaFromIgraph(data)

# code from addNodeSize()
edges <- jsonlite::fromJSON(sigmaObj$x$data)$edges
nodes <- jsonlite::fromJSON(sigmaObj$x$data)$nodes

tmp_graph <- igraph::graph_from_data_frame(d = edges,
                                                                           directed = FALSE,
                                                                           vertices = nodes$id)
nodes$size <- igraph::betweenness(tmp_graph)
table(abs(igraph::betweenness(data) - nodes$size) < 1e-12)

@iankloo
iankloo merged commit 66c449f into iankloo:development Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants