Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Louvain-algo result should be more meaningful #105

Closed
spaxfiz opened this issue Jul 8, 2021 · 4 comments
Closed

Louvain-algo result should be more meaningful #105

spaxfiz opened this issue Jul 8, 2021 · 4 comments

Comments

@spaxfiz
Copy link

spaxfiz commented Jul 8, 2021

Version: v2.0.0

Debugging with breakpoint, it seems that the louvain result only contains the core vertecies in community, which means we cannot figure out all vertecies in one community.

Here is my test data:

src,dst,weight
1,2,1.0
1,3,5.0
2,1,5.0
2,3,5.0
3,4,1.0
4,5,1.0
4,6,1.0
4,7,1.0
4,8,1.0
5,7,1.0
5,8,1.0
6,8,1.0

params:

    val louvainConfig = new LouvainConfig(5, 3, 0.005)
    val louvainResult = LouvainAlgo.apply(spark, data, louvainConfig, hasWeight = false)

And the result by calling louvainResult.show():

+---+--------+
|_id|_louvain|
+---+--------+
|  4|       4|
|  1|       1|
|  5|       5|
+---+--------+

Apparently, there are more than 3 vertecies.

And I think it's more meaningful to users by changing the code to:

def getCommunities(G: Graph[VertexData, Double]): RDD[Row] = {
    val communities = G.vertices
      .flatMap(x => {
        x._2.innerVertices
          .map(y => {
            Row(y, x._2.cId)
          })
      })
    communities
  }

Nebula Chinese forum related: https://discuss.nebula-graph.com.cn/t/topic/4701/5

@wey-gu
Copy link
Contributor

wey-gu commented Jul 9, 2021

@Nicole00 what do you think, please?

@Nicole00
Copy link
Contributor

Nicole00 commented Jul 9, 2021

@spaxfiz Thanks for your idea. I think it just another format to show the louvain's result as communitID, community vertices.
All algorithms of NebulaGraph will maintain the consistent result form: id and algorithm value. Algorithm value is one new property of vertex.
And we recommend using the api format for algorithm calls, and users can flexibly modify the results.

@wey-gu
Copy link
Contributor

wey-gu commented Jul 9, 2021

Dear @spaxfiz ,

Thanks a lot for your proposal, after talking with @Nicole00, the algorithms provided are actually sample applications and their output format are unified.

The expected case here(when the return of the algorithm app cannot fulfill requirements) was to modify/write their own ones based on the samples.

I think we could somehow improve the documentation and description to highlight both on:

  • it's recommended to customize it rather than use it as-is for all cases
  • we can use what you contributed here as an example actually

based on what you have helped contribute and pointed out here.

Thanks!

@wey-gu
Copy link
Contributor

wey-gu commented Jul 16, 2021

Will close it as it's been inactive for days. Feel free to reopen it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants