Advanced Data Visualization – 001 | Lesson 10 — Network Visualization: Force Layouts, Graph Structure and Centrality

AI GENERATED CONTENT — POSTED AS IS. Questions and topic outlines were adapted from Open Education source posts (attributed to this site and, where identified there, Sayed Ahmed). Newly AI-generated explanations, original synthetic graphics and code are offered for reuse without copyright restrictions asserted by this blog. Third-party rights remain applicable; AI can make mistakes.

Advanced Data Visualization – 001: course index · Source articles: Post 16089 · Post 26174 · Post 16135 · Post 76547

Learning goals: The network visualization collection covers node–link graphs, directed versus undirected structures, force-directed, circular, arc, hive and bundled layouts. A graph layout is a spatial representation of relationships, not an intrinsic physical geography.

Original schematic plot illustrating Network Visualization: Force Layouts, Graph Structure and Centrality.
Original course-generated illustration; synthetic values, not measurements.

Theory and practical decisions

Force-directed layouts balance attractive forces along edges and repulsive forces between nodes; algorithms are heuristic and can return different drawings across seeds. Use a fixed seed for teaching and compare stable graph measures rather than reading exact inter-node screen distances.

Degree counts immediate neighbors, betweenness identifies shortest-path brokers, and community detection groups patterns of links. Edge thickness should correspond to a documented weight; filtering weak edges changes the graph’s apparent structure.

Mathematical model

Degree kᵢ=ΣⱼAᵢⱼ; closeness C(i)=(n−1)/Σⱼ≠ᵢd(i,j) in a connected graph; betweenness B(i)=Σₛ≠ᵢ≠ₜσₛₜ(i)/σₛₜ (normalization conventions vary).

Python example and plot

import networkx as nx
import matplotlib.pyplot as plt
G=nx.Graph()
G.add_edges_from([(1,2),(2,3),(1,3),
                  (3,4),(4,5),(4,6),(5,6)])
pos=nx.spring_layout(G,seed=12)
cent=nx.betweenness_centrality(G)
nx.draw_networkx(G,pos,node_size=700,
 node_color=[cent[v] for v in G.nodes],
 cmap=plt.cm.Blues,with_labels=True)
plt.axis("off");plt.show()
print(sorted(cent.items(),key=lambda p:-p[1])[:2])

R example and plot

library(igraph)
edges <- matrix(c(1,2,2,3,1,3,3,4,4,5,4,6,5,6),
 ncol=2,byrow=TRUE)
g <- graph_from_edgelist(edges,directed=FALSE)
set.seed(12)
layout <- layout_with_fr(g)
values <- betweenness(g)
plot(g,layout=layout,vertex.size=20+3*values,
 main="Synthetic network with bridge",vertex.label.color="black")
print(sort(values,decreasing=TRUE)[1:2])

Expected output and interpretation

The bridge between the two small groups passes through vertices 3 and 4. They tend to have high betweenness. Drawing positions may change with the layout seed, but adjacency and computed centralities remain defined by the graph.

Questions and answers

Q1. Does a node drawn in the centre always have high centrality?

Answer. No. Screen position is produced by a layout algorithm, not automatically by a centrality metric.

Q2. What is a graph bridge?

Answer. An edge whose removal increases the number of connected components in an undirected graph.

Q3. When should a matrix visualization replace node–link drawing?

Answer. For dense networks where edges become a hairball or precise adjacency patterns matter.

Assessment

Draw the same graph using spring and circular layouts; compute degree and betweenness, then explain why visual position and centrality differ.

Translated to Bengali / বাংলায় অনুবাদ

বাংলা অনুবাদ: উপরের ব্যাখ্যামূলক পাঠ ও প্রশ্নোত্তরের সহজ ও শুদ্ধ বাংলা রূপ এখানে দেওয়া হলো। কোডের Python ও R সিনট্যাক্স অপরিবর্তিত।

শেখার লক্ষ্য: সাইটের নেটওয়ার্ক ভিজুয়ালাইজেশন উৎসে নোড-লিংক, দিকযুক্ত/দিকবিহীন গ্রাফ, ফোর্স-ডিরেক্টেড, বৃত্তাকার ও বান্ডলিং লেআউটের বিষয় আছে। নোডের আঁকা অবস্থান বাস্তব ভৌগোলিক অবস্থান নয়।

ফোর্স-ডিরেক্টেড লেআউটে সংযুক্ত নোড আকর্ষিত এবং নোডগুলো পরস্পর বিকর্ষিত হয়। অ্যালগরিদমের ফল র‌্যান্ডম সূচনার ওপর নির্ভর করতে পারে। শিক্ষণমূলক কাজে নির্দিষ্ট seed ব্যবহার করুন।

ডিগ্রি সরাসরি প্রতিবেশী গণনা করে; বিটুইননেস বহু সংক্ষিপ্ত পথের মধ্যবর্তী নোড শনাক্ত করে; কমিউনিটি ডিটেকশন সম্পর্কের দল নির্ধারণ করে। লিংকের পুরুত্বের অর্থ স্পষ্ট করুন।

গাণিতিক ধারণা: ডিগ্রি kᵢ=ΣⱼAᵢⱼ; সংযুক্ত গ্রাফে ক্লোজনেস C(i)=(n−1)/Σⱼ≠ᵢd(i,j); বিটুইননেস B(i)=Σσₛₜ(i)/σₛₜ। বিভিন্ন লাইব্রেরিতে স্বাভাবিকীকরণ আলাদা হতে পারে।

প্রত্যাশিত ফল: দুটি ছোট গোষ্ঠীর মধ্যবর্তী সংযোগ ৩ ও ৪ নম্বর নোড দিয়ে যায়; তাই এদের বিটুইননেস বেশি হতে পারে। লেআউট বদলালেও গ্রাফের সম্পর্ক অপরিবর্তিত থাকে।

প্রশ্ন 1. ছবির কেন্দ্রে থাকা নোড কি সবসময় গুরুত্বপূর্ণ?

উত্তর: না। অবস্থান লেআউটের ফল, কেন্দ্রিকতা মাপার ফল নয়।

প্রশ্ন 2. গ্রাফ ব্রিজ কী?

উত্তর: যে প্রান্ত সরালে সংযুক্ত অংশের সংখ্যা বেড়ে যায়।

প্রশ্ন 3. কখন নোড-লিংকের বদলে ম্যাট্রিক্স ভালো?

উত্তর: গ্রাফ খুব ঘন হয়ে রেখার জট তৈরি হলে বা নির্দিষ্ট সংযোগ পড়া জরুরি হলে।

বাংলা অনুশীলন

একই গ্রাফ স্প্রিং ও বৃত্তাকার লেআউটে আঁকুন; ডিগ্রি ও বিটুইননেস নির্ণয় করে অবস্থানের সঙ্গে পার্থক্য ব্যাখ্যা করুন।

মূল উৎসগুলোর লিংক উপরে আছে। এআই-তৈরি নিজস্ব ব্যাখ্যা ও চিত্র পুনর্ব্যবহারে এই ব্লগ থেকে কপিরাইটের বিধিনিষেধ দেওয়া হচ্ছে না। তৃতীয় পক্ষের অধিকার আলাদা। এআই ভুল করতে পারে, তাই যাচাই করুন।


Discover more from Open Education

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from Open Education

Subscribe now to keep reading and get access to the full archive.

Continue reading