Giter Site home page Giter Site logo

igraph / rigraph Goto Github PK

View Code? Open in Web Editor NEW
532.0 34.0 200.0 500.67 MB

igraph R package

Home Page: https://r.igraph.org

Makefile 0.82% R 68.96% Tcl 1.51% HTML 0.20% CSS 0.30% Shell 0.13% C 24.87% C++ 3.12% Python 0.05% CMake 0.03%
complex-networks graph-algorithms graph-theory mathematics network-analysis network-graph r

rigraph's Introduction

R-CMD-check CRAN Downloads Codecov test coverage

R/igraph igraph website

R/igraph is an R package of the igraph network analysis library.

Installation

You can install the stable version of R/igraph from CRAN:

install.packages("igraph")

For the development version, you can use R-universe

options(
  repos = c(
    igraph = 'https://igraph.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'
  )
)
install.packages('igraph')

or Github, with the pak package:

pak::pak("igraph/rigraph")

When compiling from sources, make sure that you have C, C++ and Fortran compilers, as well as development packages for glpk and libxml2. On Debian/Ubuntu, use apt install libglpk-dev libxml2-dev. On Fedora, use yum install glpk-devel libxml2-devel.

For installation from source on Windows, you need to have RTools installed. For versions R >= 4.0 you can install the dependencies using:

pacman -Sy mingw-w64-{i686,x86_64}-glpk mingw-w64-{i686,x86_64}-libxml2

Installation troubleshooting

See the Installation FAQ.

Documentation

See the igraph package's website for the complete manual.

Contributions

Please read our contribution guide.

License

GNU GPL version 2 or later

Contributors

All contributions to this project are gratefully acknowledged using the allcontributors package following the all-contributors specification. Contributions of any kind are welcome!


gaborcsardi

ntamas

vtraag

szhorvat

krlmlr

adalisan

igraph

pupamanyu

Antonov548

dmurdoch

clpippel

dougmet

wael-sadek

kasterma

cfhammill

clhunsen

rundel

qsz13

DexGroves

QuLogic

dalloliogm

Hosseinazari

hclimente

jooolia

MajoroMask

MatthieuStigler

mhils

das-intensity

peranti

RahulHP

raulzr

richardfergie

zeehio

simoncarrignon

smoe

covoes

mirca

adriandiazlab

aleszib

cynthiahqy

etheleon

stnava

rigraph's People

Contributors

adalisan avatar ahmohamed avatar antonov548 avatar aviator-app[bot] avatar clpippel avatar covoes avatar dmurdoch avatar dougmet avatar gaborcsardi avatar github-actions[bot] avatar hadley avatar iosonofabio avatar kalibera avatar krlmlr avatar maelle avatar matyasch avatar ngmaclaren avatar ntamas avatar olivroy avatar peranti avatar pupamanyu avatar rahulhp avatar raulzr avatar richardfergie avatar simoncarrignon avatar smoe avatar szhorvat avatar vtraag avatar wael-sadek avatar zeehio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rigraph's Issues

R: create temporal graphs

From @gaborcsardi on July 22, 2014 18:10

From #654.

Definitely need a method to just create the graph using the given labels for the vertices and edges. Ideally these labels could be integers, and real time labels. Need to look over how R handles dates and times for this.

  • Create graph from the supplied time labels.
  • Create graph from a sequence of events? What is a sequence of events?

Copied from original issue: igraph/igraph#655

edges between rectangular vertices may pass through vertex

From @bergsmat on September 18, 2014 18:13

library(igraph)
m <- c(
-1.0,1.0,
-0.6,0.6,
-0.2,1.0,
-1.0,0.2,
-0.2,0.2,
-0.6,-0.2,
0.2,-0.2,
-0.2,-0.6,
0.6,-0.6,
0.2,-1.0,
1.0,-1.0
)
m <- matrix(m, nrow=11,byrow=TRUE)
g <- graph.empty() 
g <- add.vertices(g, nv = 11, shape='rectangle',color=NA,size = 20)
g <- add.edges(g, c(1,2,3,2,2,4,2,5,5,6,5,7,7,8,7,9,9,10,9,11))
g <- set.graph.attribute(g,'layout',m)
png()
plot(g)
dev.off()

rplot001

Note that several edges seem to originate at the edge of the vertex that is further from the destination vertex. Effect seems more common for larger vertices larger graphs (more vertices).

Copied from original issue: igraph/igraph#682

R: isomorphism api

From @gaborcsardi on October 1, 2014 17:57

  • graph.count.isomorphisms.vf2 โ†’ count_isomorphisms
  • graph.count.subisomorphisms.vf2 โ†’ count_subgraph_isomorphisms
  • graph.isoclass.subgraph might be built into isomorphism_class
  • graph.isoclass, iso_class โ†’ isomorphism_class
  • graph.isocreate, graph_from_iso_class โ†’ graph_from_isomorphism_class
  • graph.isomorphic โ†’ is_isomorphic_to, isomorphic
  • graph.isomorphic.34 should be added to isomorphic
  • graph.isomorphic.bliss should be added to isomorphic
  • graph.isomorphic.vf2 should be added to isomorphic
  • graph.subisomorphic.lad add to subgraph_isomorphic, is_subgraph_isomorphic_to
  • graph.subisomorphic.vf2 add to subgraph_isomorphic, is_subgraph_isomorphic_to
  • graph.get.isomorphisms.vf2โ†’ isomorphisms
  • graph.get.subisomorphisms.vf2 โ†’ subgraph_isomorphisms

So we'll have

  • is_isomorphic_to (isomorphic)
  • is_subgraph_isomorophic_to (subgraph_isomorphic)
  • count_isomorphisms
  • count_subgraph_isomorphisms
  • isomorphisms
  • subgraph_isomorphisms
  • isomorphism_class
  • graph_from_isomorphism_class

Copied from original issue: igraph/igraph#715

R: better plotting order

From @gaborcsardi on May 4, 2013 18:59

Right now edges are plotted first, then vertices, then vertex labels. This this not optimal if some vertices overlap. It would be better to plot first the edges, and then the vertices one after another, vertex by vertex.


Imported from Launchpad using lp2gh.

Copied from original issue: igraph/igraph#296

Temporal graphs in R: at() operator

From @gaborcsardi on July 24, 2014 18:33

at("2010", degree(g))

I.e.

at(time-point, expression-with-graphs)

We need to be able to mark the graphs in the expression, so that when they will be converted to C graphs, their now tag will be set properly.

We might need to forbid the nesting of at() expressions, otherwise a graph would get multiple tags.

We also need to check if having multiple at() functions in an expression causes a problem:

graph.intersect( at("2001", g), at("2010", g) )

Actually it might be enough to have a (thread-specific?) global variable, that contains the current time. This variable is set at the beginning of at(), and reset (i.e. removed, invalidated) at the end of at().

Copied from original issue: igraph/igraph#664

graph.dfs and graph.bfs in R package pass 0-based index to callback function

From @djhshih on March 22, 2014 1:28

In the R interface, graph.dfs and graph.bfs seem to be passing 0-based indices to the callback function instead of 1-based indices.
The results returned by the function uses 1-based indexing.

library(igraph)
sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-unknown-linux-gnu (64-bit)
...
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] igraph_0.7.0

f <- function(graph, data, extra) print(data);
g <- graph.tree(10);
tmp <- graph.dfs(g, root=1, "out", in.callback=f);
vid dist
0 0
vid dist
1 1
vid dist
3 2
vid dist
7 3
vid dist
8 3
vid dist
4 2
vid dist
9 3
vid dist
2 1
vid dist
5 2
vid dist
6 2

tmp
...
$order
[1] 1 2 4 8 9 5 10 3 6 7
...

Copied from original issue: igraph/igraph#601

R: delete attributes by setting them to NULL

From @gaborcsardi on October 8, 2014 2:42

library(igraph)
a <- graph.ring(10)
V(a)$name <- letters[1:10]
a$name <- "Foo"
E(a)$weight <- 1:10
a
#>  IGRAPH UNW- 10 10 -- Foo
#>  + attr: name (g/c), mutual (g/l), circular (g/l), name (v/c), weight
#>    (e/n)

a$name <- NULL
a
#>  IGRAPH UNW- 10 10 -- NA
#>  + attr: name (g/x), mutual (g/l), circular (g/l), name (v/c), weight
#>    (e/n)
a$name
#>  NULL

V(a)$name <- NULL
#>  Error in `V<-`(`*tmp*`, value = 1:10) : invalid indexing

E(a)$name <- NULL
#>  Error in `E<-`(`*tmp*`, value = 1:10) : invalid indexing

Copied from original issue: igraph/igraph#722

R: remove suggested packages completely

From @gaborcsardi on April 22, 2014 0:14

This is the safest thing to do if you want the package to build on CRAN.

Maybe we can formally remove the Matrix dependency as well, but that one is harder, and since Matrix is a recommended package, maybe not as important.

Copied from original issue: igraph/igraph#609

R: 0.8 pre version question

From @happyshows on November 11, 2014 16:22

Hi,

I'd like to deploy my R app on linux server needed 'get.all.simple.path' function in 0.8 pre. However I'm not able to install the igraph package on that because of the error in source tar.gz.
Is there any timeline to fix the current compilation error? Also, what's the target date to release 0.8 production version?

Thanks.

Copied from original issue: igraph/igraph#761

R: return vertex names instead of vertex ids

From @gaborcsardi on May 4, 2013 18:54

Or, instead of returning a character vector, we could return an igraph.vs. The same for edges.

igraph.vs is a bit tricky, because we don't necessarily want the (potentially big) graph hanging around just because there is an igraph.vs object hanging around somewhere.

An alternative would be to return character vectors with symbolic vertex ids.


Imported from Launchpad using lp2gh.

Copied from original issue: igraph/igraph#113

R: rename operators in V() and E()

From @gaborcsardi on May 13, 2014 13:52

To avoid situations like this:

library(igraph)
g <- graph.ring(10)
nei <- 1:10
V(g)[ nei == 1 ]
# Error in nei == 1 : 
#   comparison (1) is possible only for atomic and list types

If they start with a dot, then this is much less likely to happen.

Copied from original issue: igraph/igraph#617

R: Modify the order in which the vertices are drawn

From @gaborcsardi on May 4, 2013 18:56

I mean, it should be possible to draw the vertices in a given order. Also, draw the vertices and the labels together, to avoid the case when a label of a vertex is on top even if the vertex itself is in the bottom.


Imported from Launchpad using lp2gh.

Copied from original issue: igraph/igraph#148

attempting to set font family on edge causes plotting error

From @bergsmat on September 18, 2014 13:31

For example (version 0.7.1) ...

library(igraph)
g <- graph.empty() 
g <- add.vertices(g, nv = 3)
g <- add.edges(
  g, 
  c(1,2,2,3), 
  attr = list(
    label=c('foo','bar'),
    label.family=rep('mono',times = 2)
  )
)
plot(g)

... gives ...

Error in text.default(lc.x, lc.y, labels = edge.labels, col = edge.label.color,  : 
  graphical parameter "family" has the wrong length

Like issue #213, but for edges not vertices. Same workaround applies. Code above works for times = 0 but not times = 1 etc.

Copied from original issue: igraph/igraph#681

R: data conversion between igraph and gis

From @gaborcsardi on July 14, 2014 15:7

From Manuel Herrera Fernandez:

Hi everybody!

I'm working with an igraph network (in R) with coordinates corresponding to real data. The next stage of my analysis should be combine that igraph network with a GIS polygon. I already captured GIS into R by a number of methods (by using sp and maptools or rgdal etc.) but any of them allow to me combining these two plots into one.

I'd appreciate very much if you share with me possible ideas to handle this part of my work.

Thanks in advance,

Copied from original issue: igraph/igraph#646

R: Implement GephiGraphStreamer

From @supersambo on January 28, 2014 12:44

as it's done for the python version http://igraph.sourceforge.net/doc/python/igraph.remote.gephi.GephiGraphStreamer-class.html

  • Sending graphs to Gephi.
  • Receiving graphs from Gephi.
  • Manipulating graphs in Gephi.
  • Connecting an R graph to a Gephi graph.

This last one is not straightforward, because R objects are immutable. But we can have an environment (or reference class) that contains an igraph graph.

Copied from original issue: igraph/igraph#572

confusing error message after incorrect use of vertices

From @kasterma on June 25, 2014 9:15

I am fairly new to igraph (using it from R). After quite a long debugging session yesterday I found the problem which is simplified in the below R session.

> gg <- graph.empty() + vertices(c(1,2,3,4)) + edges(c("1","2","3","4"))
> gg+gg
Error in `+.igraph`(g, setdiff(uninames, V(g)$name)) : 
  Cannot add unknown type to igraph graph

Corrected session

> gg <- graph.empty() + vertices(as.character(c(1,2,3,4))) + edges(c("1","2","3","4"))
> gg + gg
IGRAPH DN-- 4 2 -- 
+ attr: name (v/c)

Turns out vertices just wraps its arguments in a list with attribute class set to "igraph.vertex". And then the fact that the vertex names are integers in stead of characters is only noticed later when doing the graph union (in the context I was working in there were more graphs adding to the space of things to examine for errors).

I am not familiar enough with the code to understand the impact, but would suggest adding an assertion or build in as.character to vertices.

Copied from original issue: igraph/igraph#635

R interface basic operations

From @gaborcsardi on June 25, 2013 20:12

From Florian Klinglmueller:

I have been playing around with igraph lately and think that it is a great package as it adds tremendous functionality to R. However, I continually get into trouble with basic edge and vertex operations, especially, adding and removing edges. I have added some examples of confusion at the end of this mail and attached the code.

I think that there is a certain lack of consistency in how they operate, to the degree that I would consider it a bug. Maybe I'm just wrong in expecting that the examples given below should work in some consistent way. However, it makes it extremely difficult to decide whether a certain way to operate on some elements of a graph (e.g. get all edges via E(G) or get.edges(G,...)) will work for a certain problem or not (e.g. add them to a graph via + or add.edges, ...) when writing code. A major problem that I see is that it is essentially unclear how to write iterators over the nodes or edges of an igraph object (without resorting to exporting to other classes (eg via get.edgelist)).

R 2.15.1> require(igraph)
Loading required package: igraph
R 2.15.1> # Consider the following graphs
  R 2.15.1>
    R 2.15.1> G4 <- graph.full(4)
R 2.15.1> G <-  minimum.spanning.tree(G4)
R 2.15.1> g <-  G4 - G
R 2.15.1>
  R 2.15.1> G[]
Loading required package: Matrix
Loading required package: lattice
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . 1 1 1
[2,] 1 . . .
[3,] 1 . . .
[4,] 1 . . .
R 2.15.1> g[]
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . . . .
[2,] . . 1 1
[3,] . 1 . 1
[4,] . 1 1 .
R 2.15.1>
  R 2.15.1> # now here comes what confuses me
    R 2.15.1>
      R 2.15.1> for(e in E(G))
        +   print(delete.edges(G,e)[])
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . . 1 1
[2,] . . . .
[3,] 1 . . .
[4,] 1 . . .
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . 1 . 1
[2,] 1 . . .
[3,] . . . .
[4,] 1 . . .
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . 1 1 .
[2,] 1 . . .
[3,] 1 . . .
[4,] . . . .
R 2.15.1>
  R 2.15.1> # works
    R 2.15.1>
      R 2.15.1> for(e in E(G))
        +   print(add.edges(g,e)[])
Error in print(add.edges(g, e)[]) :
  error in evaluating the argument 'x' in selecting a method for function 'print': Error in add.edges(g, e) :
    At type_indexededgelist.c:269 : invalid (odd) length of edges vector, Invalid edge vector
R 2.15.1>
  R 2.15.1> # gives an error
    R 2.15.1>
      R 2.15.1> # next
        R 2.15.1> e <- E(G)[1]
R 2.15.1> E <- get.edge(G,1)
R 2.15.1>
  R 2.15.1> delete.edges(G,e)[]
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . . 1 1
[2,] . . . .
[3,] 1 . . .
[4,] 1 . . .
R 2.15.1> # removes one edge
  R 2.15.1>
    R 2.15.1> delete.edges(G,E)[]
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . . . 1
[2,] . . . .
[3,] . . . .
[4,] 1 . . .
R 2.15.1> # removes two edges
  R 2.15.1>
    R 2.15.1> (G - e)[]
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . . 1 1
[2,] . . . .
[3,] 1 . . .
[4,] 1 . . .
R 2.15.1> # works
  R 2.15.1>
    R 2.15.1> (G - E)[]
2 x 2 sparse Matrix of class "dgCMatrix"

[1,] . .
[2,] . .
R 2.15.1> # empty graph with 2 nodes
  R 2.15.1>
    R 2.15.1> add.edges(g,e)
Error in add.edges(g, e) :
  At type_indexededgelist.c:269 : invalid (odd) length of edges vector, Invalid edge vector
R 2.15.1> # error messag
  R 2.15.1>
    R 2.15.1> add.edges(g,E)[]
4 x 4 sparse Matrix of class "dgCMatrix"

[1,] . 1 . .
[2,] 1 . 1 1
[3,] . 1 . 1
[4,] . 1 1 .
R 2.15.1> # works
  R 2.15.1>
    R 2.15.1> g + E
Error in `+.igraph`(g, E) : Cannot add unknown type to igraph graph
R 2.15.1> # error
  R 2.15.1>
    R 2.15.1> (g + e)[]
5 x 5 sparse Matrix of class "dgCMatrix"

[1,] . . . . .
[2,] . . 1 1 .
[3,] . 1 . 1 .
[4,] . 1 1 . .
[5,] . . . . .
R 2.15.1> # adds a node ???
  R 2.15.1>

Copied from original issue: igraph/igraph#502

R interface for temporal graphs

From @gaborcsardi on July 22, 2014 18:10

From #616.

TODO list

  • is.temporal() checks if the graph is temporal. #656.
  • creating graphs, #655
  • at() operator, #664
  • printing graphs, #657
  • as.temporal, just add a minimal calendar.
  • g$now and g$now<-, #658.
  • Operators. E.g. if g is temporal, then g+g should be temporal. What to do with the union of a temporal and a non-temporal graph, etc.? #662
  • Functions to query on/off times of vertices and edges. #663

Copied from original issue: igraph/igraph#654

rglplot edge labels bug

From @gaborcsardi on July 2, 2014 17:24

el <- cbind(sample(1:5), sample(1:5))
g <- graph.edgelist(el)
rglplot(g, edge.label = letters[1:ecount(g)])

gives

Error in layout[, 4] : subscript out of bounds

Copied from original issue: igraph/igraph#639

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.