Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Seth Bromberger
    @sbromberger
    hi all
    is there a way to do per-vertex triangle counting using igraph-python?
    I see the R function
    alexperrone
    @alexperrone
    Hi, I'd like to add a function to igraph C and would like guidance on how to get it built with the rest of igraph. The code is here: https://github.com/alexperrone/igraph and it references this PR: igraph/igraph#1034
    In response to ntamas, I looked at Makefile.am and it did not have a SOURCES variable. However, Makefile did, although it was blank so it seemed strange to add my function that environmental variable since that does not seem to be the usual route. I also searched both of these make files for any other mentions of .cpp files (the function I want to add requires C++) and did not find any such files listed (like walktrap_communities.cpp, for example). So I'm not sure what to add where to get my file (truss.cpp, truss.h, and the code in examples/simple/igraph_truss.cpp) incorporated into the build system.
    Szabolcs Horvát
    @szhorvat
    @alexperrone Makefile is generated, do not touch it. You must edit src/Makefile.am
    Szabolcs Horvát
    @szhorvat
    @alexperrone As for truss.h, there should not be one. You already added the function to igraph_community.h. The functions you declare in that header are all private to one file, and are never used outside of that one. If you need forward declarations, I suggest you put them directly in that file.
    @alexperrone In the doc comment, the \function name must match the name of your function. https://github.com/igraph/igraph/pull/1034/commits/2bfd70fd7e035049a3ff4ccdddafe4ef4603d7df#diff-2423e8c5cf30a2ba737e72edce931764R35
    @alexperrone Why do you need iostream? I can't find where it's used. If it's not used, remove it. Note that igraph functions should not be writing to the terminal. https://github.com/igraph/igraph/pull/1034/commits/2bfd70fd7e035049a3ff4ccdddafe4ef4603d7df#diff-2423e8c5cf30a2ba737e72edce931764R28
    Szabolcs Horvát
    @szhorvat
    examples/simple/igraph_truss.cpp does not need to be added to Makefile.am, as it is just an example and it won't be built as part of the library.
    alexperrone
    @alexperrone

    Thank you, that works! I am able to build it successfully now. The problem was I was looking at igraph/Makefile.am and not igraph/src/Makefile.am. I have now updated src/Makefile.am: alexperrone/igraph@7b41fdf

    I will address the other comments soon.

    Szabolcs Horvát
    @szhorvat
    @alexperrone OK. Do @mention me or @ntamas , otherwise we may not notice your message.
    Szabolcs Horvát
    @szhorvat

    @ntamas I would like to implement something for C/igraph that essentially looks like an iterable in Python. Is there anything I need to pay attention to to make sure that it can be included as an actual iterable in the Python interface?

    To give an example, it would be comparable to finding cliques. Right now these problems are handled with callback functions: there's a function that generates all cliques and invokes the callback for all of them. The callback can signal to the main function to stop. But once we stop, we can't resume. What I want instead is to store the generator state in an object, and draw cliques from it as needed. I can resume any time for as long as I still have the generator object.

    This would be a nicer design for cliques too, but in this case it would be for generating all graphs with a given property.

    @gaborcsardi Please see above. Is there anything that I should pay attention to to make sure that such a construct with be easy to integrate into the R interface?
    Tamás Nepusz
    @ntamas

    Hmmm, never tried to implement a Python iterable directly with the C API, but I guess it would go like this. Suppose that I add a new method on the Graph object called itercliques(). This would probably call down to your C function, which would then return some kind of a C data structure that stores the state of the iteration. I would then wrap it on the Python side in a Python capsule (https://docs.python.org/2/c-api/capsule.html), and create another Python object (the iterator) that stores a reference to the capsule and provides an __iter__() method (returning itself) and a next() method. The next() method would then extract your data structure from the capsule call back to your C function to retrieve the next item.

    The only thing to watch out for is probably to construct your iterable in a way that the invocation of the first function that constructs the iterable does not start the actual clique search process until someone calls next() from the Python layer and invokes the second function.

    Szabolcs Horvát
    @szhorvat
    @ntamas Any opinions on this? igraph/igraph#1163
    On a related note, it would also make sense if igraph considered the null graph (0 vertices) to not be connected (it has no components, thus it does not have precisely one connected component). The problem is that changing this is very risky because several other functions rely on this one, and edge cases like the null graph are not well covered in the test suite. In practice better not touch it.
    Szabolcs Horvát
    @szhorvat
    @ntamas It's probably best to just return 0 after all.
    It makes a little bit of sense in light of the Menger's theorem definition https://en.wikipedia.org/wiki/K-edge-connected_graph#Formal_definition
    Which is also what makes sense for vertex connectivity
    Thus, the vertex connectivity of 1-2 is 1, as there is only one vertex-disjoint path between 1 and 2
    However, 1-2 is biconnected (despite a vertex connectivity of 1 and not 2) because we need to remove 2 vertices in order to disconnect the graph
    Szabolcs Horvát
    @szhorvat
    @gaborcsardi For igraph_adhesion, the docs say: "Graph adhesion, this is (almost) the same as edge connectivity." It actually just calls igraph_edge_connectivity. Is there supposed to be a difference? Why is it phrased as "almost"?
    Szabolcs Horvát
    @szhorvat
    @ntamas @gaborcsardi Do you happen to have an archive of the LAD code on which the igraph LAD port was based? As I remember, the code on the author's webpage was updated and the older versions are gone. This makes it impossible to transfer the bugfixes that were made to the igraph version. I am struggling with a (reproducible) out-of-bounds crash in the igraph LAD code. ASAN tells me where exactly the overflow is it is, but the algorithm is complicated and I can't fix it.
    Szabolcs Horvát
    @szhorvat
    @ntamas Good to be aware: https://stackoverflow.com/q/55974657/695132 Just in case you try this with a new gcc and then realize that it doesn't work with a not-so-old one.
    Szabolcs Horvát
    @szhorvat
    @ntamas Is there a way to include named links in the documentation, such as <a href="http://dx.doi.org/foobar">Fancy Paper Title</a>? Or are we stuck with Fancy Paper Title, see http://dx.doi.org/foobar?
    @ntamas Regarding this, igraph/igraph#1181 , I messed up something and I need more time to investigate. It may be Raspberry Pi specific.
    @ntamas Currently, all the tests are in examples/simple. But a test is not educational and an educational example is not a good test. What do you think about adding a new tests subdirectory specifically for tests?
    I want to add both an example and a proper test for igraph/igraph#1168
    Tamás Nepusz
    @ntamas
    @szhorvat re named links: I'm afraid that we don't support this at the moment
    @szhorvat having a separate tests directory would be great - the "simple" examples are not so simple after all, and they are not even examples
    so I'm all for it if you have time to do it
    tobymiller1
    @tobymiller1
    I'm trying to use python-igraph from AWS Lambda, but it tells me "Unable to import module 'runner': No module named 'igraph._igraph'". I've built the whole thing in an amazonlinux docker image, so I would have thought that the build environment would match, and there is an igraph directory in the root of the lambda zip, containing among other things a .so file. Am I missing something about how this should work? Thanks!
    Vincent Traag
    @vtraag
    @tobymiller1 you are probably executing code from the source directory, or something equivalent, see https://stackoverflow.com/questions/32342541/no-module-named-igraph-igraph. Perhaps that solves the problem?
    tobymiller1
    @tobymiller1
    Thanks @vtraag, I'll see if I can get it to work