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

Gephi plugin - Make changes to labels visible #1842

Closed
MK2345 opened this Issue Nov 15, 2017 · 13 comments

Comments

Projects
None yet
2 participants
@MK2345

MK2345 commented Nov 15, 2017

Expected Behavior

I am currently writing a plugin for Gephi. Gephi is integrated into NetBeans as a platform.
In this plugin changes should be made in the labels of the nodes and then made visible under Overview -> Nodes -> Partition -> Select Attributes in the graph.

Current Behavior

After the plugin has been executed, the changes to the labels are visible in Data Lab.
But in the Overwiew there is no way to assign a specific color or size to the node of the label, depending on the changed labels.

Possible Solution

Did I forget anything in the implementation?

Steps to Reproduce

Context

Your Environment

  • Version used: Gephi 0.9.2
  • Java version: JDK 8
  • Operating System: NetBeans 8.2
@eduramiba

This comment has been minimized.

Show comment
Hide comment
@eduramiba

eduramiba Nov 15, 2017

Member

Hi,
I think you can change the visualization attributes of labels with node.getTextProperties(). See https://gephi.org/graphstore/apidocs/index.html

Anyway, what do you mean Gephi is integrated in Netbeans? For making a plugin you should follow this simple process explained here: https://github.com/gephi/gephi-plugins

Member

eduramiba commented Nov 15, 2017

Hi,
I think you can change the visualization attributes of labels with node.getTextProperties(). See https://gephi.org/graphstore/apidocs/index.html

Anyway, what do you mean Gephi is integrated in Netbeans? For making a plugin you should follow this simple process explained here: https://github.com/gephi/gephi-plugins

@eduramiba eduramiba self-assigned this Nov 15, 2017

@MK2345

This comment has been minimized.

Show comment
Hide comment
@MK2345

MK2345 Nov 15, 2017

Thank you for the quick answer.
Gephi is integrated as an platform in NetBeans.
I have change the labels with node.setLabel(....).
Now I tried to insert a column in the nodeTable, which is also displayed in Gephi, but the new values of
the labels will not be entered there.

MK2345 commented Nov 15, 2017

Thank you for the quick answer.
Gephi is integrated as an platform in NetBeans.
I have change the labels with node.setLabel(....).
Now I tried to insert a column in the nodeTable, which is also displayed in Gephi, but the new values of
the labels will not be entered there.

@eduramiba

This comment has been minimized.

Show comment
Hide comment
@eduramiba

eduramiba Nov 15, 2017

Member

Can you share your code?

Member

eduramiba commented Nov 15, 2017

Can you share your code?

@MK2345

This comment has been minimized.

Show comment
Hide comment
@MK2345

MK2345 Nov 15, 2017

MK2345 commented Nov 15, 2017

@eduramiba

This comment has been minimized.

Show comment
Hide comment
@eduramiba

eduramiba Nov 15, 2017

Member

The overview automatically shows the current label by default, you don't have to do anything for it to show the correct value after you do a setLabel

I am really trying to understand what you are trying to do but I don't get the problem. Also, why Gephi as a platform in Netbeans? I am not even sure that will work fine and is not the intended use case of Gephi.

By looking at #1844, if what you are trying to do is show a custom column as the label in overview, then either simply configure overview to show that column as the node text (can be done in overview settings panel (small button at the down-right corner), or listen to changes in a column with a column observer (check example code in data laboratory used for refreshing the table when column values change https://github.com/gephi/gephi/blob/master/modules/DesktopDataLaboratory/src/main/java/org/gephi/desktop/datalab/DataTablesObservers.java)

Member

eduramiba commented Nov 15, 2017

The overview automatically shows the current label by default, you don't have to do anything for it to show the correct value after you do a setLabel

I am really trying to understand what you are trying to do but I don't get the problem. Also, why Gephi as a platform in Netbeans? I am not even sure that will work fine and is not the intended use case of Gephi.

By looking at #1844, if what you are trying to do is show a custom column as the label in overview, then either simply configure overview to show that column as the node text (can be done in overview settings panel (small button at the down-right corner), or listen to changes in a column with a column observer (check example code in data laboratory used for refreshing the table when column values change https://github.com/gephi/gephi/blob/master/modules/DesktopDataLaboratory/src/main/java/org/gephi/desktop/datalab/DataTablesObservers.java)

@eduramiba eduramiba referenced this issue Nov 15, 2017

Closed

Gephi Plugin #1844

@MK2345

This comment has been minimized.

Show comment
Hide comment
@MK2345

MK2345 Nov 15, 2017

ok, in the code changes on the labels are to be made. Here I have a while loop in which after each iteration by the for loop is to check whether changes were made to the labels. The change of the labels does happen by an algorithm which called label propagation, which is used to discover communities. In this algorithm, the labels are changing. Only when all communities have been discovered, the labels are not changed further. Here then the termination of the while loop would have to be done. I would like to do this by comparing the graph with its state before the last iteration through the loop. If no change has occurred to the graph (labels), the while loop should be aborted.

MK2345 commented Nov 15, 2017

ok, in the code changes on the labels are to be made. Here I have a while loop in which after each iteration by the for loop is to check whether changes were made to the labels. The change of the labels does happen by an algorithm which called label propagation, which is used to discover communities. In this algorithm, the labels are changing. Only when all communities have been discovered, the labels are not changed further. Here then the termination of the while loop would have to be done. I would like to do this by comparing the graph with its state before the last iteration through the loop. If no change has occurred to the graph (labels), the while loop should be aborted.

@eduramiba

This comment has been minimized.

Show comment
Hide comment
@MK2345

This comment has been minimized.

Show comment
Hide comment
@MK2345

MK2345 Nov 15, 2017

Thank you very much, but in the closed #1844 I hoped for another possibility, because this seemed a bit complicted.
Ok, how do I program this? I tried that, but it does not work for me. My Code is as follows

public void execute(GraphMode graphModel){
Table nodeTable = graphModel.getNodeTable();

  Column col = nodeTable.getColumn(prob);
  if (col == null) {
     col = nodeTable.addColumn(prob, String.class);
  }
  // I think a have to set here the ColumnObserver, but how do I do that?

 while(change) {
       for(Node n : nodes){
              .......
       } //end of for loop. Here I have to test if something has changed 

Could you help me again?

MK2345 commented Nov 15, 2017

Thank you very much, but in the closed #1844 I hoped for another possibility, because this seemed a bit complicted.
Ok, how do I program this? I tried that, but it does not work for me. My Code is as follows

public void execute(GraphMode graphModel){
Table nodeTable = graphModel.getNodeTable();

  Column col = nodeTable.getColumn(prob);
  if (col == null) {
     col = nodeTable.addColumn(prob, String.class);
  }
  // I think a have to set here the ColumnObserver, but how do I do that?

 while(change) {
       for(Node n : nodes){
              .......
       } //end of for loop. Here I have to test if something has changed 

Could you help me again?

@MK2345

This comment has been minimized.

Show comment
Hide comment
@MK2345

MK2345 Nov 15, 2017

ok, on the first position in the code above I set:
ColumnObserver observer = col.createColumnObserver(true);

On the second position in the code above I have set:
if (observer.hasColumnChanged()){
change = true;
}else{
change = false;
}

But the while loop doesn't stop. What could be the reason.

MK2345 commented Nov 15, 2017

ok, on the first position in the code above I set:
ColumnObserver observer = col.createColumnObserver(true);

On the second position in the code above I have set:
if (observer.hasColumnChanged()){
change = true;
}else{
change = false;
}

But the while loop doesn't stop. What could be the reason.

@eduramiba

This comment has been minimized.

Show comment
Hide comment
@eduramiba

eduramiba Nov 15, 2017

Member

Well, your while loop always evaluates to true unless you change changed variable inside the loop (your complete code is at http://forum-gephi.org/viewtopic.php?f=34&t=6325&p=14715#p14715)

Member

eduramiba commented Nov 15, 2017

Well, your while loop always evaluates to true unless you change changed variable inside the loop (your complete code is at http://forum-gephi.org/viewtopic.php?f=34&t=6325&p=14715#p14715)

@MK2345

This comment has been minimized.

Show comment
Hide comment
@MK2345

MK2345 Nov 15, 2017

change changed inside the while loop but outside the for loop. That should be right.

MK2345 commented Nov 15, 2017

change changed inside the while loop but outside the for loop. That should be right.

@eduramiba

This comment has been minimized.

Show comment
Hide comment
@eduramiba

eduramiba Nov 15, 2017

Member

Sorry but you will need to debug your code, it's doing an infinite loop, and that has nothing to do with the observer. Checking the observer outside the loop does not make any sense for your use case.

Member

eduramiba commented Nov 15, 2017

Sorry but you will need to debug your code, it's doing an infinite loop, and that has nothing to do with the observer. Checking the observer outside the loop does not make any sense for your use case.

@eduramiba

This comment has been minimized.

Show comment
Hide comment
@eduramiba

eduramiba Nov 16, 2017

Member

Closing as not an issue with Gephi but a coding question instead.

Member

eduramiba commented Nov 16, 2017

Closing as not an issue with Gephi but a coding question instead.

@eduramiba eduramiba closed this Nov 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment