Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
graph-tool
graph-tool
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 44
    • Issues 44
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tiago Peixoto
  • graph-toolgraph-tool
  • Issues
  • #463

Closed
Open
Opened May 01, 2018 by Alain Fonhof@alainfh94
  • Report abuse
  • New issue
Report abuse New issue

[feature requrest] Rich-club coefficient

@count0 I was wondering if you ever got around to implementing the rich-club coefficient algorithm as discussed in this thread: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Rich-club-td4025697.html

Just for reference this is the algorithm I would love to see in graph-tool: https://networkx.github.io/documentation/stable/reference/algorithms/generated/networkx.algorithms.richclub.rich_club_coefficient.html#networkx.algorithms.richclub.rich_club_coefficient

I made a small start but I am not quiet sure how to implement the normalization with graph-tool.

def rich_club_coefficient(g):
    deghist = gt.vertex_hist(g, 'total')[0]
    total = sum(deghist)
    rc = {}
    # Compute the number of nodes with degree greater than `k`, for each
    # degree `k` (omitting the last entry, which is zero).
    nks = (total - cs for cs in np.cumsum(deghist) if total - cs > 1)
    deg = g.degree_property_map('total')
    for k, nk in enumerate(nks):
        if nk == 0:
            continue
        sub_g = gt.GraphView(g, vfilt=lambda v: deg[v] > k)
        ek = sub_g.num_edges()
        rc[k] = 2 * ek / (nk * (nk - 1))
    return rc
Edited May 01, 2018 by Alain Fonhof
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: count0/graph-tool#463