# How do I generate node coordinates?

Hello wonderful people!

I am trying to generate node coordinates so that I can build a network graph like in this video:-

Visualising Networks with Tableau | Sophie Hiscock - YouTube

Using a python script is not a viable solution for my use case.

Does anyone know how I can do this, preferably with KNIME core or community nodes?

Hi @TosinLitics,
Using Network Mining nodes you can create network graph.
If you provide a sample data set and explain your case, perhaps we can provide an example workflow.

2 Likes

Hello Armingrudd!

I have provided sample data.

Sample Data.xlsx (9.9 KB)

Essentially, I would like to visualize a network graph on Tableau to show the interrelation between persons and companies. For the Tableau visualization, I need X and Y coordinates.

The sample data shows the order in which a person went through companies, but I am not sure if this will be relevant for a network graph. In the data, we have three persons who worked at both companies in red and blue; I’d like to show that these companies are liked due to this.

I am new to network graphs, so I really appreciate help on this!

Here you are:
netwrok-graph.knwf (36.6 KB)

I have used KNIME Network Mining nodes to create the graph. If you have further questions, don’t hesitate to ask.

Hello @armingrudd,

Thank you for the workflow. It looks great and is very useful for me to further understand creating a graph visual in KNIME !

But what I need for this specific use case are X Y coordinates for each node in the network graph, this is what will enable me to create the network visual on Tableau.

For instance in python, you can generate them with this code:

Q = nx.Graph()
arr_SrcTgt= np.array(df_InputData[[Src_Column, Tgt_Column]])
dict_Coords = nx.spring_layout(Q)

df_Raw_Coords = DataFrame(dict_Coords)
df_Raw_Coords = df_Raw_Coords.T
df_Raw_Coords.columns = [‘X’,‘Y’]
df_Raw_Coords[‘NodeName’] = df_Raw_Coords.index

#Add in a “Node Name” for cases where nodes do not link with another named node

df_Raw_Coords.fillna(“Not Specified”, inplace = True)

Here is another version including a branch which prepares the dataset for Tableau:
netwrok-graph.knwf (48.3 KB)

Here is the vis on Tableau Public:
https://public.tableau.com/app/profile/armingrudd/viz/Network-graphexample/Sheet1?publish=yes

1 Like

@armingrudd

This looks very promising!

I will try it with my actual data and let you know how it goes.

Thanks especially for providing a Tableau example

@armingrudd

I have been able to replicate this on my data. Thank you!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.