X Tutup
The Wayback Machine - https://web.archive.org/web/20201026074939/https://github.com/igraph/igraph/issues/1061
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Degree mixing matrix #1061

Open
briatte opened this issue Feb 14, 2018 · 4 comments
Open

Degree mixing matrix #1061

briatte opened this issue Feb 14, 2018 · 4 comments

Comments

@briatte
Copy link

@briatte briatte commented Feb 14, 2018

Dear igraph authors,

I would like to know if there are (or has been) any plans to include a degree mixing matrix function in igraph.

  • This issue is for the C core of igraph.
  • This issue is a bug report or a feature request, not a support question.
@ntamas
Copy link
Member

@ntamas ntamas commented Feb 15, 2018

There are no plans to include such a function, but pull requests are welcome.

@ntamas ntamas added wishlist C labels Feb 15, 2018
@szhorvat
Copy link
Contributor

@szhorvat szhorvat commented Apr 16, 2018

Some notes:

  • This is called the joint degree matrix in graph theory (when not normalized), and sometimes studied similarly to degree sequences. This name should be at least mentioned, or perhaps used for the function.
  • It is beneficial to return a sparse matrix result for efficiency (think scale-free degree distribution)
  • In view of the above (and of the simplicity of implementation), it may be a better idea to implement it directly in the higher level interfaces (R/Python) and use the native or common sparse matrix type of the language. IGraph/M (Mathematica) already has it, and C implementation probably wouldn't be noticeably more performant.
@ntamas
Copy link
Member

@ntamas ntamas commented Apr 16, 2018

We have a sparse matrix data type in the C layer as well, so we can make use of that if we decide that it should be implemented in the C layer. But, at least in Python, there is no direct dependency between the Python-C glue code and NumPy, and I want to keep it that way, so the best that the Python-C glue code can do (without depending on NumPy) is to return a list of (outdeg, indeg, count) triplets that can then be fed into a sparse matrix constructor. The Python interface can then import numpy dynamically at runtime and convert it into a NumPy sparse matrix if it is installed (and throw an ImportError otherwise).

@ntamas ntamas added PR welcome good first issue and removed C labels Jul 9, 2018
@szhorvat
Copy link
Contributor

@szhorvat szhorvat commented Nov 15, 2018

If this is implemented, it should have an option to (optionally!) set the maximum degree for the result. This is useful when generating joint degree matrices for several graphs, and we want them to be of compatible size so they can operated (e.g. added) together.

If the maximum degree of the graph is smaller than what is requested, the result will simply be padded with zeros.

This advice is based on practical experience from using a joint degree matrix function.

Example:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.
X Tutup