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

first version of standard drawing method #69

Merged
merged 9 commits into from
Dec 6, 2018

Conversation

MengLiuPurdue
Copy link
Collaborator

No description provided.

@coveralls
Copy link

coveralls commented Nov 26, 2018

Pull Request Test Coverage Report for Build 87

  • 158 of 188 (84.04%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 90.185%

Changes Missing Coverage Covered Lines Changed/Added Lines %
localgraphclustering/GraphLocal.py 55 63 87.3%
localgraphclustering/GraphDrawing.py 102 124 82.26%
Totals Coverage Status
Change from base Build 78: -0.7%
Covered Lines: 1608
Relevant Lines: 1783

💛 - Coveralls

@dgleich
Copy link
Collaborator

dgleich commented Nov 26, 2018

Meng, can we rip out the use of networkx drawing and just use our routines? Also, the return values for nodelist/etc are the list of nodes, not the actual handles to the plot elements.

@MengLiuPurdue
Copy link
Collaborator Author

@dgleich Let me know how you feel on the new template.

@dgleich
Copy link
Collaborator

dgleich commented Nov 27, 2018

Okay, this is coming along!

We still need stuff to visualize a vector of entries over the nodes, e.g. a fiedler vector or ACL vector.

I don't like how you are creating a vector of colors, that seems like it could be done more efficiently. (And allow for colormap scaling, etc.)

Groups should also take in a partition vector (e.g. each key is a group, in addition to a group-of-groups)

@MengLiuPurdue
Copy link
Collaborator Author

@dgleich
Let me know if the latest commit solves the first two issues (except the groups).

@dgleich
Copy link
Collaborator

dgleich commented Nov 28, 2018 via email

@MengLiuPurdue
Copy link
Collaborator Author

@dgleich I am not very sure how to return plot handles... Is there a simple example I can refer to? "draw_star" is just plot all the edges connect to a specific node, like a star.

@dgleich
Copy link
Collaborator

dgleich commented Nov 28, 2018

Things I know we want to do.

  1. Draw a graph with a given set of coordinates. (Flexible edge
    alpha, node alpha, node color, line color, line widths, etc., node sizes,)

  2. Draw a graph and highlight a set of nodes.

  3. Draw a graph and show values over the nodes (possibly a sparse set)

  4. Draw a graph and highlight both a set and values.

  5. Draw a graph with groups/clusters

  6. Draw a grah with groups/clusters and highlight a set.

For all the plot elements, we should be able to customize sizes,
transparency, and colors.

Does it make sense to draw groups and a set of values over the graph?

Other
5.

G = lgc.GraphLocal()
elems = G.draw(coords)
elems = G.draw(coords, nodeset=S)
elems = G.draw(coords, values=v, nodeset=S)

elems = G.draw_groups(coords, g)
elems = G.draw


G = lgc.GraphLocal()

drawing = G.draw(coords)
drawing.highlight(set)
drawing.edge_linewidth

drawing = G.draw(coords, values=fiedler(G)[0], valuecenter = 0, colormap=PuOr)

drawing.highlight(set, othernodes=False, otheredges=False) # hide other nodes and edges
drawing.highlight(set, othernodes=False) # hide other edges

drawing = G.draw(coords, values=v)
drwaing = G.draw(coords, values=v, sizes=s

drawing = G.draw_groups(coords, g, sizes=s)
drawing.highlight(set)
drawing.between_group_alpha(0.5)

drawing.highlight(set, filled=False) # only circle the nodes

drawing.nodecolor(i,c=None) # returns the current nodecolor
drawing.nodecolor(i,c=[
drawing.edgecolor(i,j,c=None)


class GraphDrawing
def init(self, G, coords, ax):
self.G = G
self.coords = coords
self.is_3d = len(coords[0]) == 3
self.edgepos = self._build_edgepos(G)
if ax == None:
fig, ax = plt.subplots()
else:
fig = ax.get_figure()
self.ax = ax
self.fig = fig

    nodes = ax.scatter()
    edges = LineCollection()
    
    
    
def show(self):
    return fig

drawing = G.draw(coords)
drawing.show() # this returns the figure, to show it in a Jupyter window, for instance


drawing = G.draw(coords, ax = ax)

@MengLiuPurdue
Copy link
Collaborator Author

@dgleich There are still a lot of details to finish, but I'd like to show you the structure and some examples in "new_visualization_examples.ipynb". Let me know how you feel about it.

@dgleich
Copy link
Collaborator

dgleich commented Nov 30, 2018 via email

@dgleich
Copy link
Collaborator

dgleich commented Dec 4, 2018

Okay, this is looking pretty good, there still needs to be more documentation.

Also, please use the python pattern "_plotting" to denote "private" functions. (Most of the things you have tagged as staticmethod should be private.)

For the default colormap, we have PuOr for when valuecenter is provided. Otherwise can we use magma?

Can you also use ax._sci()... to setup the colormap on the values?

David

@MengLiuPurdue
Copy link
Collaborator Author

@dgleich I am not sure what ax._sci() does. Do you have a small example?

@dgleich
Copy link
Collaborator

dgleich commented Dec 5, 2018 via email

@dgleich
Copy link
Collaborator

dgleich commented Dec 5, 2018

Okay, why were the two bioinformatics notebooks deleted?

Do we need the "class" files and such? Why can't we just use the GraphML like we used to? If we need them, can you store the info as integers and lower-precision floats? These take up a lot of space!

Also, the job seems to have failed :)

@MengLiuPurdue
Copy link
Collaborator Author

@dgleich Those two were deleted because I have rewritten them using the new interface. If we stick to the original GraphML, it will take more code and even have to use graph_tools to extract the ground truth. To make the examples more clear, I decided to save the class info into a separate file so that we can read them in one line. But I will use some other data type to save the space. And yes, the job probably failed due to the new MQI code, I haven't tested it throughly.

@dgleich
Copy link
Collaborator

dgleich commented Dec 5, 2018 via email

@MengLiuPurdue
Copy link
Collaborator Author

MengLiuPurdue commented Dec 5, 2018

@dgleich We can, but my point is in the original notebook, taking ppi_mips as an example, it still needs three files ppi_mips.graphml, ppi_mips_coordinates.xy and ppi_mips_ground_truth.csv to get the graph, its layout and the ground truth. Also, it needs some additional code to preprocess the coordinates and ground truth file which makes the notebook less cleaner. Right now, the new notebook needs ppi_mips.graphml, ppi_mips.xy and ppi_mips.class and it doesn't need any preprocessing at all. All I did is to save the preprocessed results and we can safely delete ppi_mips_coordinates.xy and ppi_mips_ground_truth.csv.

@dgleich
Copy link
Collaborator

dgleich commented Dec 5, 2018 via email

@kfoynt kfoynt merged commit 362a0ac into kfoynt:master Dec 6, 2018
@kfoynt
Copy link
Owner

kfoynt commented Dec 6, 2018

Btw, are there any examples of this in the notebooks folder?

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

Successfully merging this pull request may close these issues.

None yet

4 participants