comp4048 course outline comp4048 information …shhong/comp4048.pdfcomp4048 information...

55
COMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 www.it.usyd.edu.au/~shhong/COMP4408.html Coordinator: Seokhee Hong ([email protected]) COMP4048 Course Outline Course Aims Learning Outcomes Assumed Knowledge Assessment School Policies Academic Honesty Special Consideration Topics covered Course Aims The unit will provide basic concepts, techniques and algorithms to achieve good visualisation of abstract information. We will also provide opportunities for academic research and developing systems for information visualisation. Learning Outcomes You will gain knowledge of the basic concepts, techniques and algorithms to produce good visualization of abstract data efficiently. More specifically: understanding of geometric algorithms and visualization methods be able to apply visualization methods for application area use of geometric algorithms and concepts to solve new problems experience and develop skills to implement geometric algorithms Assessment Paper review: 20% (week 10,11,12) individual Programming assignment: 80% (week 13) team School Policies http://www.cs.usyd.edu.au/ postgrad/coursework/policies.html You are required to visit this URL and carefully read the policies on Academic Honesty, and Special consideration due to illness and misadventure No late submissions allowed for any reason whatsoever

Upload: ngohuong

Post on 28-May-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

1

COMP4048Information Visualisation

2004 Semester 2

Thursday 10 am-12 noonCarslaw Building Room 451www.it.usyd.edu.au/~shhong/COMP4408.htmlCoordinator: Seokhee Hong ([email protected])

COMP4048 Course Outline

Course AimsLearning OutcomesAssumed KnowledgeAssessment School Policies

• Academic Honesty• Special Consideration

Topics covered

Course Aims

The unit will provide basic concepts, techniques and algorithms to achieve good visualisation of abstract information.

We will also provide opportunities for academic research and developing systems for information visualisation.

Learning Outcomes

You will gain knowledge of the basic concepts, techniques and algorithms to produce good visualization of abstract data efficiently.More specifically:• understanding of geometric algorithms and

visualization methods• be able to apply visualization methods for

application area• use of geometric algorithms and concepts to

solve new problems• experience and develop skills to implement

geometric algorithms

Assessment

Paper review: 20% (week 10,11,12) individual

Programming assignment: 80% (week 13) team

School Policies

http://www.cs.usyd.edu.au/• postgrad/coursework/policies.html

You are required to visit this URL and carefully read the policies on• Academic Honesty, and• Special consideration due to illness and

misadventure

No late submissions allowed for any reason whatsoever

Page 2: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

2

Topics Covered: Week 1-6

Approximate schedule: topics are subject to changeWeek 1 (July 29) : Introduction to Information Visualisation and Graph DrawingWeek 2 (Aug 5) : Spring Algorithm and Force Directed Methods Week 3 (Aug 12) : Layered Graph DrawingWeek 4 (Aug 19) : Layered Graph DrawingWeek 5 (Aug 26) : Network Analysis and VisualisationWeek 6 (Sep 2) : Graph Models / Ambient Visualisation

Topics Covered: Week 7-13

Approximate schedule: topics are subject to changeWeek 7 (Sep 9) : Tree Visualisation MethodsWeek 8 (Sep 16) : Human Perception for Information DisplayWeek 9 (Sep 23) : Invited lecture (Keith Nesbitt) Week 10 (Oct 7) : Paper Review and Presentation Week 11 (Oct 14) : Paper Review and Presentation Week 12 (Oct 21) : Paper Review and Presentation Week 13 (Oct 28) : Presentation/ Demo of Programming Assignment

Main Textbook

Giuseppe Di Battista, Peter Eades, Roberto Tamassia, Ioannis G. Tollis, "Graph Drawing: Algorithms for the Visualization of Graphs", Prentice-Hall, 1999.

References

Michael Kaufmann, Dorothea Wagner eds., “Drawing Graphs - Methods and Models”, Springer-Verlag, Lecture Notes in Computer Science, vol. 2025, 2001. Kozo Sugiyama, “Graph Drawing and

Applications”, World Scientific, 2001.

Proceedings: GD proceedings (annual symposium on graph drawing), 1993-2001, LNCS, Springer Verlag

Lecture 1

Information Visualisation and

Graph DrawingInformation Visualisation

Page 3: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

3

Visualisation

Visualisation:the use of computer-supported, interactive, visual representations of data to amplify cognition.

• Scientific visualisation:the use of computer-supported, interactive, visual representations of scientific data to amplify cognition.

• Information visualisation:the use of computer-supported, interactive, visual representations of abstract data to amplify cognition.

Scientific Visualisation

Scientific visualisation

visualising plaque on an artery wall.Colin Currie, Dept. of Medicine, University of Sydney.

Astrophysics - Astronomy

Visualisation of the Durham/UKST Galaxy Redshift Survey Andrew Ratcliffe, Physics, University of Durham, U.K

Chemistry - Biochemistry

Molecular Modelling of Immunosuppressant Molecules Bound to an Enzyme Peter Karuso, School of Chemistry, Macquarie University

Chemistry - Biochemistry

Molecular Modelling AnimationPeter Karuso, School of Chemistry, Macquarie University

Page 4: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

4

Engineering

Phase Transformation of Silicon during Nano-Indentation H. Tanaka, L. C. Zhang, Dept of Mechanical Engineering, University of

Sydney

Geophysics

Fly Thru of the Bathymetric Data obtained for East Bass StraitBen Simons, Sydney VisLab/ Chris Jenkins, Prof. Jock Keene,

Dept of Geology and GeoPhysics, University of Sydney

Material Sciences

Microscopic Structure of Tetrahedral Amorphous Carbon N.A. Marks, D. R. McKenzie, B. A. Pailthorpe, Applied Physics,

University of Sydney

Visualisation in Medical Science

Weidong Cai et al., BMIT

Geographic Visualisation

Geographic visualisation

Visualisation of the NSFNET

Geographic visualisation of WWW Traffic

Geographic visualisation of the Mbone

Page 5: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

5

Visualisation of the NSFNET

NSF T1 Backbone (1991)

Visualisation of the NSFNET

NSF T1 Backbone (1991)

Visualisation of the NSFNET

NSF T3 Backbone (1993)

SeeNet

• [Becker, Eick, Wilks 95]• Visualizing Network Data

SeeNet3D

[Cox, Eick 95] 3D Displays of Network Trafficarcs on globe layout

Visualizing the Topology of the MBone

time: 1996data: MBone tunnels task: find badly placed tunnelsgoal: simple baselinemethod: 3D geographic

Visualizing the Global Topology of the MBoneTamara Munzner and Eric Hoffman and K. Claffy and Bill FennerProceedings of the 1996 IEEE Symposium on Information Visualization,

Page 6: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

6

Information Visualisation

The loss of Napoleon’s army

Web Site Visualization

NicheWorks• [Robertson, Mackinlay, Card, CHI 91]

Cone Tree

2D Hyperbolic Tree Browser

[Lamping, Rao, Pirolli, CHI’95] A Focus+Context Technique Based on Hyperbolic Geometry for Visualizing Large Hierarchies.

Software Visualisation

A.S.M. Sajeev, Wendy Wang, Aaron Quigley

Page 7: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

7

Visualisation of Stock Market Data

Keith Nesbitt

Information Visualization

Abstract Data PicturePicture

Information visualization research aims to make pictures of abstract data so that humans can understand, navigate, and manipulate the data.

Good visualization

• H. Beck

Bad visualization

ALP

Data Knowledge PicturePictureanalysis visualization

Graph Graph drawing

Visualization of Abstract Information

There are two steps:1. Analysis: extracting a graph from the information2. Visualization: Graph drawing

Visualization of football transfers

Drew moved from the Panthers to the EelsMiles moved from the Roosters to the EaglesGreen moved from the Cowboys to the RoostersO’Hara moved from the Bulldogs to the Raiders. . . . . .

GraphdrawingAnalysis

Data Graph Picture

Page 8: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

8

Reference Model for Visualisation

RawData

DataTable

VisualStructures

Views

Data Visual Form

Human Interaction

DataTransformations

VisualMappings

ViewTransformations

References

Online: Olive

Books• Colin Ware, Information Visualization : Perception for Design (Morgan Kaufmann Interactive Technologies Series), 2000.• Robert SpenceInformation Visualization, ACM Press• Chen, Information Visualisation and Virtual Environments. Springer-Verlag, London, 1999.

Conferences and Proceedings• IEEE Infovis, ACM SIGCHI, VisSym, IV…

Olive

On-line Library of Information Visualization Environmentshttp://www.otal.umd.edu/Olive/

Temporal1D2D3DMulti-DTreesNetworksWorkspace

all citations, all projects, all products…

Focus+context display techniques

FishEye View

(Leung and Apperley, 1994)(Sarkar and Brown, 1994). the document lens (Robertson and Mackinlay 1993), the perspective wall (Mackinlay, Robertson and Card, 1991)

the perspective wall (Mackinlay, Robertson and Card, 1991)

Trees

Cone tree

Tree map

Hyperbolic tree• 2D• 3D

Page 9: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

9

• [Robertson, Mackinlay, Card, CHI 91]"Cone Trees: Animated 3D visualizations of hierarchical information.

Cone Tree Cone Tree

The Cone Tree modifies F+C approach by embedding the tree in a three dimensional space.

This embedding of the tree has joints that can be rotated to bring different parts of the tree into focus.

This requires currently expensive 3D animation support.

Trees with more than approximately 1000 nodes are difficult to manipulate.

[Johnson, Shneiderman 91] Treemaps: A Space-filling Approach to the Visualization of Hierarchical Information

Tree Maps Tree Maps

Treemaps allocates the entire space of a display area to the nodes of the tree by dividing the space of a node among itself and its descendants according to properties of the node.

This technique utilizes space efficiently and can be used to look for values and patterns amongst a large collection of values which agglomerate hierarchically.

However it tends to obscure the hierarchical structure of the values and provides no way of focusing on one part of a hierarchy without losing the context.

2D Hyperbolic Tree Browser

[Lamping, Rao, Pirolli, CHI’95] A Focus+Context Technique Based on Hyperbolic Geometry for Visualizing Large Hierarchies. Distortion & Hierarchy

M.C. Escher, Circle Limit IV (Heaven and Hell)

Page 10: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

10

Star Treeshttp://startree.inxight.com/index.html

Star Trees are interactive maps that help users easily navigate large amounts of information. Users can quickly view and understand whole websites, information directories, catalogs, organization charts and other large document collections.

2D Hyperbolic Browser

HOW IT WORKS1. CLICK on a node to center it.2. DRAG the tree to move it.3. DOUBLE-CLICK node to launch page.

Star Trees

H3: 3D Hyperbolic

data: web hyperlinks• quasi-hierarchical

graphs: can find reasonable spanning tree using domain-specific information

goal: scalability

H3: Laying Out Large Directed Graphs in 3D Hyperbolic Space Tamara MunznerProceedings of the 1997 IEEE Symposium on Information Visualization

Example

Cat-a-Cone

Cat-a-Cone: An Interactive Interface for Specifying Searches and Viewing Retrieval Results using a Large Category Hierarchy[Marti A. Hearst and Chandu Karadi, ACM/SIGIR 97]

novel user interface that integrates search and browsing of very large category hierarchies.• separate but simultaneous display of the

representations of the categories and the retrieved documents.

• display of multiple selected categories simultaneously, complete with their hierarchical context

Page 11: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

11

The WebBook and the Web Forager:An Information Workspace for

the World-Wide Web

[Stuart K. Card, George G. Robertson, and William York, CHI’96]

The WebBook: a 3D interactive book of HTML pages. The WebBook allows rapid interaction with objects at a higher level of aggregation than pages.

The Web Forager: an application that embeds the WebBook and other objects in a hierarchical 3D workspace.

The Web Book

Example of a WebBook

Example of ruffling pages in a WebBook

The Web Book

WebBook viewed with a Document Lens.

The Web Forager

Spatial metaphors for Information Exploration

Geographical information system of Boston area

Crime data

Page 12: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

12

Another view

An Organic User Interface For Searching Citation LinksJock D. Mackinlay, Ramana Rao, Stuart K.

Card,ACM CHI’95

Butterfly: an Information Visualizerapplication for accessing DIALOG's Science Citation databases across the Internet

Visualizing a Knowledge Domain's Intellectual Structure

[Chaomei Chen and Ray J. Paul]Visualizing a knowledge domain’s intellectual structure. IEEE Computer, 34(3), 2001.

a method that extends and transforms traditional author co-citation analysis (ACA) by extracting structural patterns from the scientific literature and representing them in a 3D knowledge landscape

A four-step procedure for visualizing intellectual structures. Knowledge landscape of three subject domains:computer graphics, hypertext, and virtual environments

Page 13: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

13

NicheWorks: Exploring Large Networks

http://www.bell-labs.com/user/gwills/NICHEguide/niche.html

NicheWorks - Interactive Visualization of Very Large Graphs, by Graham J Wills.

Typical analyses performed using NicheWorks have between 20,000 and 1,000,000 nodes.

Web Site Visualization

Circle, Hexagonal and Tree layout

Department home page area with some labeled nodes

Web Site Visualization Example

Overview of calling patterns

International Calling Fraud

40,000 calls involving 35,000 callers

Example

High users' calling patterns

International Calling FraudInternational Calling Fraud

possible fraud patternThe Israel-Jordan-UAE generated subset zooming in to those callers calling more than

one country

Page 14: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

14

NicheWorks: The Chicago Tribune Website

The goal of the analysis was to understand the structure of the site and see what design criteria had been used in its production.

Features noticed:• There are a set of key entry URLs.• You cannot go off-site from the top-level page.• The most heavily referred-to URLs are the Tribune

banner: pix/th95.gif and an image indicating a team has won: pix/wonbut.gif.

Example

Initial look

Searching for all URLs with a CGI request including the 'AdID' keyword and selecting all the links to those pages resulted in the above image.

SAGE

SPIRE

CAIDA

Information Visualisation Systems & Applications

SAGE

SDM

VISAGE

SAGEhttp://www-2.cs.cmu.edu/Groups/sage

The loss of Napoleon’s army

Edward R. Tufte, The Visual Display of Quantitative Informationby Charles Joseph Minard (1781-1870)Russian-Polish border 422,000 men / Moscow 100,000 men.

Page 15: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

15

Napoleon Graphic by SAGE

use of color to express temperature during marches between cities the clear gaps which indicate lengthy stays at particularlocations as well as the battle sites.

Another View of Napoleon Graphic

SAGE: Data Exploration

the utility of SAGE for exploratory data analysis.Users can obtain displays of diverse combinations of information

SDM

This system permits the viewer to select certain data points and manipulate the other surrounding data for better visualization.

SDM SDM

Page 16: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

16

SPIRESPIRE-Spatial Paradigm for Information Retrieval and

Exploration

SPIRE provides a wealth of tools for exploring the information, including query, subset, and trend analysis tools.

http://www.pnl.gov/infoviz/spire/spire.htmlPacific Northwest National Laboratory, USA

Galaxies

Galaxies

The Galaxies visualization uses the image of stars in the night sky to represent a set of documents.

Each document is represented by a single "docustar."

Closely related documents cluster together while unrelated documents are separated by large distances.

Several analytical tools are provided with Galaxies to allow users to investigate the document groupings, query the document contents, and investigate time-based trends.

ThemeView

ThemeView

The topics or themes within a set of documents are shown as a relief map of natural terrain. The mountains in the ThemeView indicate dominant

themes. The height of the peaks indicates the relative strengths of

the topics in the document set. Similar themes appear close together, while unrelated

themes are separated by larger distances.ThemeView provides a visual overview of the major topics

contained in a set of documents. Combined with its exploration tools, ThemeView permits

the analyst to identify unanticipated relationships and examine changes in topics over time.

WebTheme

Page 17: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

17

WebTheme

WebTheme is a web-enabled version of SPIRE that provides a new way to investigate and understand large volumes of textual information.

It has the ability to harvest data from the World Wide Web using search terms, or by following links derived from user specified URLs.

Users can rapidly identify themes and concepts found among thousands of pages of text, and then further explore areas of interest.

CAIDA

CAIDA, the Cooperative Association for Internet Data Analysis, provides tools and analyses promoting the engineering and maintenance of a robust, scalable global Internet infrastructure.

http://www.caida.org

The AS Internet graph One of CAIDA's skitter project goals is to develop techniques to illustrate relationships and depict critical components of the Internet infrastructure.

The graph reflects 626,773 IP addresses and 1,007,723 IP links of skitter data from 16 monitors probing approximately 400,000 destinations spread across over 48,302 (52%) of globally routable network prefixes.

Then aggregate this view of the network into a topology of Autonomous Systems (ASes), each of which approximately maps to an Internet Service Provider (ISP).

The abstracted graph consists of 7,624 Autonomous System (AS) nodes and 25,126 peering sessions.

The AS Internet graphA Macroscopic Visualisation of the Internet During October, 2000

Walrus - Graph Visualization Tool Walrus is a tool for interactively visualizing large directed graphs in three-dimensional space. By employing a fisheye-like distortion, it provides a display that simultaneously shows local detail and the global context.

Walrus computes its layout based on a user-supplied spanning tree.Walrus uses 3D hyperbolic geometry to display graphs under a fisheye-like distortion.

Some are network topology graphs derived from skitter measurements, with sizes ranging from ten thousand to five hundred thousand nodes. Others represent our web site directory hierarchy (around 14000 nodes), CVS repository (around 18000 nodes), and directory trees.

Walrus - Graph Visualization Tool

CVS Repository18,474 nodes18,473 links

Page 18: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

18

Walrus - Graph Visualization Tool

Directory Trees

Walrus - Graph Visualization Tool

Riesling54,893 nodes79,409 links

Walrus - Graph Visualization Tool Internet Mapping Project

Bill Cheswick, Bell Labs and Hal Burch, CMU

a long-term project to collect routing data on the Internet.This mapping consists of frequent traceroute-style path probes, one to each registered Internet entity. They build a tree showing the paths to most of the nets on the Internet.

These paths change over time, as routes reconfigure and the Internet grows. They are preserving this data to show how the Internet grows.

layout showing the major ISPs.

map appeared in the December 1998 Wired.

Page 19: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

19

Colored by ISPs, the city-states of the Internet. colored by IP address, 29 June 1999.

Graph Drawing

Hofstadter. Godel, Escher, Bach.[Gansner and North]improved force-directed layouts.

Graph Drawing

Graph Drawing

Graphs are abstract structure that are used to model relational information.

Graph G=(V,E)•V: set of vertices (objects)•E: set of edges connecting vertices(relationship)

Graph Drawing: automatic construction of geometric representations of graphs in 2D or 3D.

Graph DrawingThe classical graph drawing problem is to develop algorithms to draw graphs.

A - B, C, DB - A, C, DC - A, B, D, ED - A, B, D, EE - C, D

The input is a graph with no geometry

A B

D

C

E

The output is a drawing of the graph; the drawing should be easy to understand, easy to remember, beautiful.

Page 20: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

20

file edit insert layout

Graph Drawing

agnt(monkey, eat).inst(eat, spoon).obj(eat, walnut).part_of(walnut, shell).matr(spoon, shell).

The graph drawing problem is to design methods to give good drawings of graphs.

monkeymonkey

eateat

spoonspoon shellshell

walnutwalnut

agntagnt

instinst

objobj

part_ofpart_of

matrmatr

The input graph is usually some relational description of a software system.

The output picture is used in a system design/analysis tool.

_ X

Tangled drawing

Untangled drawing Applications

Software engineeringDatabaseInformation systemRealtime systemComputer NetworkVLSIAIData MiningBioinformaticsDecision support systemBiologyChemistry…

GraphDrawing

VLSI- circuit schematics

Decision Support System- Pert network

Real-time System- Petri nets- state transitiondiagrams

Software Engineering- data flow diagram- subroutine call graph- program nesting trees- object oriented class

hierarchy

Information System- organization

charts

Data base- entity relationship

diagram

Artificial intelligence- knowledge

representationdiagram

Graphs

tree• free tree• binary tree• rooted tree• ordered tree

planar graphsgeneral graphsdirected graphsextended graph model

• hierarchical graphs• clustered graphs• hyper graphs• higraphs

Page 21: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

21

Drawing conventions

polyline drawing

straight-line drawing

orthogonal drawing

grid drawing

planar drawing

upward drawing

Orthogonal drawing

bend

Straight-line drawing

Polyline drawing Upward drawing

Drawing conventions

monkey eat

spoon

shell

walnut

agnt

inst

obj

part_of

matr

less readable

monkey

eat

spoon shell

walnutagnt

inst

obj

part_of

matr

more readable

readability: the drawing should be easy to read, easy to understand, easy to remember, beautiful.

Aesthetics Aesthetics

crossingsareasymmetryedge length

• total edge length, maximum edge length, uniform edge length

bends• total bends, maximum bends, uniform bends

angular resolutionaspect ratio

Readability is sometimes measured by aesthetic criteria

Avoidedge crossings

Avoidedge bends

Avoidlong edges

monkey eat

spoon

shell

agnt

inst part_of

matr

less readable

walnut

obj

Crossings and bends

monkey eat

spoon

shell

walnut

agnt

inst

obj

part_of

matr

One should spread the nodes evenly over the page.This can be measured:

• minimise area (for fixed size nodes)

or equivalently• maximise resolution

(for a fixed size screen).

Area and resolution

Page 22: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

22

• minimum edge crossings,

• minimum bends, • minimum edge lengths,• maximum resolution,

and many more.

monkey

eat

spoon shell

walnutagnt

inst

obj

part_of

matr

more readable

There are many aesthetic criteria for good diagrams:

Aesthetics NP-hardness

minimize crossings

minimize area

maximize symmetry

minimize total edge length

minimize number of bends

Conflicts

Minimize edge crossings Maximize symmetry

Graph Drawing System

Latour tree visualization

I. Herman, G. Melançon, M.S. Marshall,VisSym99http://www.cwi.nl/InfoVisu/

Schematic View

Page 23: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

23

Radial layout of 29773 nodes Reingold-Tilford layout of 3255 nodes

Tom Sawyer Software, USA

Hierarchical layout Symmetric layout Circular layout

Hermes/GDToolkit, Italy AGD, Germany

Page 24: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

24

AT&T, USA

Derek Renouf, Adaptive Arts

141

DaVinci

142

DaVinci

Graph Drawing ApplicationsVisualization of

Biochemical Pathways

Falk Schreiber

Page 25: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

25

Map of protein-protein interactions. The colour of a node signifies the phenotypic effect of removing the corresponding protein (red, lethal; green, non-lethal;

orange, slow growth; yellow, unknown). By Hawoong JeongRelated Pathways Tim Dwyer

Visualisation of Stock Market Data

Tim Dwyer

Visualisation of Fund Manager Movement Graph

Hierachical topology of the international web cache By Bradley Huffaker

Image of Social links in Canberra, Australia By A. S. Klovdahl Erdos' second neighborhood graph Lincoln LuLincoln Lu

Page 26: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

26

151Maolin Huang

Graph Navigation System Hierarchical clusteringsand 3D clusters,

Dr. A. Quigley|V|=3825 |E|=11031

|V|=1008 |E|=4196 |V|=93 |E|=353

3D Tree Drawing Algorithms

Seokhee Hong PolyPlanePolyPlane: 3D tree drawing algorithm : 3D tree drawing algorithm SeokheeSeokhee HongHong

School of IT School of IT webgraphwebgraph visualisation visualisation SeokheeSeokhee HongHongHome directory visualisation Home directory visualisation SeokheeSeokhee HongHong

Page 27: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

27

Hollywood collaboration network visualisation Hollywood collaboration network visualisation SeokheeSeokhee HongHong

3D Planar Graph Drawing Algorithms

Seokhee Hong

3D Orthogonal Graph Drawing

David Wood

Lecture 2Algorithms for Drawing Trees

andSeries-Parallel Digraphs

(1) Basic Concepts &Terminology

(2) Tree Drawing Algorithms

(3) Series-Parallel Digraphs

[Battista,Eades,Tamassia,Tollis] chapter 2,3 [Kaufman,Wagner] chapter 2,3

(1) Basic Concepts & Terminology

Planar GraphsPlanar Drawings and EmbeddingsPlanarity TestingPlanar Straight-line drawingPlanar Orthogonal drawingVisibility RepresentationPlanarization method

1. Planar Graphs: DefinitionsPlanar DrawingA planar drawing of a graph G=(V,E) is a mapping of the

vertices in V to distinct points in the plane and of the edges in E to open Jordan curves with the following properties:• For all edges e = (u,v) in E, the representation of e

connects the representation of u with the representation of v.

• The representations of two disjoint edges have no common points except at common endpoints.

• The representation of and edge e does not contain the representation of a vertex that is not incident to e.

Planar GraphA graph G is planar if and only if there is a planar drawing

of G.

Page 28: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

28

Planar Graph[Kuratowski’s Theorem]A graph G is planar if and only if it does not

contain a subdivision of K5 or K3,3.

K5 K3,3

[Euler’s fomula] a simple planar graph with n vertices has at most 3n-6 edges (sparse).

2. Planar Drawing & Embeddings

Planar EmbeddingA planar drawing determines a circular ordering on the neighbors of each vertex v according to the clockwise sequence of the incident edges around v.planar embedding: an equivalence class of planar drawings and is described by the circular order of the neighbors of each vertex. A planar graph may have an exponential number of embeddings in worst case (triconnected case: unique).

3. Planarity Testing

4. Planar Straight-line Drawings Planar Straight-line Drawings

Page 29: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

29

5. Planar Orthogonal Drawings:Minimization of Bends

Planar Orthogonal Drawings:Minimization of Bends

Example of Flow Network [Tamassia87]

6. Visibility Representation [Tamassia,Tollis96]

From Visibility Representations To Orthogonal Drawings

7. Planarization Method :Drawing General Undirected

Graphs

Page 30: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

30

A Simple Planarization Method A Simple Planarization Method

GIOTTO [Tamassia Di Battista Batini 88]

Planarization Method

(2) Tree Drawing Algorithms

1. layered drawing

2. hv-drawing

3. radial drawing

4. other methods

1. Layered Drawing

rooted (binary) tree Tassign layer according to the depth-> y-coordinates: y(v) = depth of vhow to compute x-coordinates?

Page 31: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

31

Simple Methodinorder traversal• layered grid drawing• two flaws:

– too wide: width n-1– parent vertex is not centered

with respect to the children

Reingold-Tilford Algorithm [RT81] (Tidier Drawing Algorithm)

Divide• recursively apply the algorithm

to draw the left and right subtrees of T.

Conquer• move the drawings of subtrees

until their horizontal distance equals 2.

• place the root r vertically one level above and horizontally half way between its children.

• If there is only one child, place the root at horizontal distance 1 from the child.

Implementation

Two traversals• step 1. postorder traversal

For each vertex v, recursively computes the horizontal displacement of the left & right children of v with respect to v.

• step 2. preorder traversalComputes x-coordinates of the vertices by

accumulating the displacements on the path from each vertex to the root.

Postorder Traversalleft (right) contour: the sequence of vertices vi such that vi is the leftmost (rightmost)vertex of T with depth i

In conquer step, we need to follow the right contour of the left subtree and the left contour of the right subtreeAfter we process v, we maintain the left & right contour of the subtree rooted at v as a linked list

Postorder TraversalProcessing v: scan the right contour of the left subtree

and the left contour of the right subtreeaccumulate the displacements of the vertices on the left & right contourkeep the max. cumulative displacement at any depth

Construction of contour list: v with T’, T’’case 1: height(T’) = height(T’’) case 2: height(T’) < height(T’’)case 3: height(T’) > height(T’’)

Postorder TraversalL(T) (R(T)): left (right) contour of T

case 1: height(T’) = height(T’’) • L(T) = L(T’) + v• R(T) = R(T’’) + v

case 2: height(T’) < height(T’’)• R(T) = R(T’’) + v• L(T) = v+ L(T’) + {part of L(T’’) starting from w}

– h’: depth of T’– w: the vertex on L(T’’) whose depth = h’+1

case 3: height(T’) > height(T’’) : similar to case2

Page 32: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

32

Postorder Traversalit is necessary to travel down the contours of two subtrees T’ and T’’ only as far as the height of the subtree of lesser height

the time spent processing vertex v in the postorder traversal is proportional to the minimum heights of T’ and T”

The sum is no more than the number of vertices of the treeHence, it runs in linear time

[Theorem] Tidier Drawing Algorithm constructs a drawing of a binary tree T in linear time such that the drawing is• layered, planar, straight-line and strictly downward• O(n2) area• two vertices are at horizontal & vertical distance at least 1• parent vertex is centered with respect to its children• isomorphic subtrees have congruent drawing up to a

translation• axially isomorphic subtrees have congruent drawings, up to

a translation & a reflection in y-axis

Non Optimal Width

Local horizontal compaction at each conquer step does not always compute a drawing of minimal width• can be solved in

polynomial time using linear programming

• NP-hard if grid drawing

• [Supowit, Reingold 83]

Generalization

generalization to rooted trees• reasonable

drawing• root is placed at

the average x-coordinates of its children

• small imbalance problem: [Tilford81], [Walker90]

2. HV-Drawinghv-drawing of a binary tree T: straight-line grid drawing such that for each u, a child of u is either• horizontally aligned with and to

the right of u, or vertically aligned with and below u

• the bounding rectangles of the subtrees of u do not intersect

planar, straight-line, orthogonal, and downward

Divide & Conquer method

Divide: recursively construct hv-drawings for the left & right subtrees

Conquer: perform either horizontal combination or a vertical combination

The height & width are each at most n-1

Page 33: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

33

Algorithm Right-Heavy-HV-Tree-Draw

1. Recursively construct drawing of the left & right subtrees

2. Using only horizontal combination, place the subtree with the largest number of vertices to the right of the other one.

height of the drawing is at most logn

Algorithm Right-Heavy-HV-Tree-Draw

[Theorem] Algorithm Right-Heavy-HV-Tree-Draw construct a drawing of binary tree T with n vertices such that the drawing is• hv-drawing (downward, planar, grid, straight-

line and orthogonal)• area O(nlogn)• width is at most n-1• height is at most logn• simply and axially isomorphic subtrees have

congruent drawings, up to a translation

Algorithm Right-Heavy-HV-Tree-Draw

Good area bound, but bad aspect ratioBetter aspect ratio: use both vertical and horizontal combinationsComplete binary tree: O(n) area and constant aspect ratioAVL tree: O(n) area [Crescenzi,DiBattista,Piperno92]

[Eades,Lin,Lin92, Eades,Lin,Lin93]It is possible to construct an hv-drawing of a binary tree that is optimal with respect to area or perimeter in O(n2) time.

use dynamic programming approach

General Binary Tree

Can be extended to general rooted tree

[Theorem] There is an algorithm that constructs a drawing of rooted tree T with n vertices in linear time such that the drawing is• downward, planar, grid, straight-line• area O(nlogn)• width is at most n-1• height is at most logn• simply and axially isomorphic subtrees have

congruent drawings, up to a translation

Generalization 3. Radial DrawingLayers are represented as concentric circlesdraw each subtree in annulus wedge W

Page 34: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

34

3. Radial Drawing

to guarantee planarity, define convex subset F of the wedge.

3. Radial Drawing

used for free trees• select the center as a root

can be used to display symmetry: [Kamada88], [Manning, Atallah88]

Variations: [Eades92], [Bernard81], [Esposito88]• choice of root, • radii of the circles,• how to determine the size of the wedge

4. Other Methods Tip – Over Drawings

[Eades,Lin,Lin 92] Tip – Over Drawings of rooted treeupward planar orthogonal drawings such that the children of the node:• are arranged either horizontally or vertically• share portions of the edges to the parent

• Used for organization charts• Allow better fit the drawing

in a prescribed region

Inclusion Tree Drawing[Eades,Lin,Lin92] Inclusion Drawing of Rooted TreesDisplay the parent-child relationship by the inclusion between isothetic rectangles.Minimization of area (perimeter, width, height)• NP-hard for general trees• Polynomial time for balanced trees

• Used for compounds graphs (union of a graph and a tree)• Allow better fit the drawing

in a prescribed region

Upper Bound on Area

[Garg,Goodrich,Tamassia 93] planar polyline upward grid drawings with O(n) area

Lower Bounds on Area[Garg,Goodrich,Tamassia96] : O(nloglogn) area• upward planar orthogonal grid drawing of binary tree

[Chan,Goodrich,Kosaraju,Tamassia97]• Recursive winding technique: O(nlogn) area (O(nloglogn) if

upward)• Planar straight-line orthogonal grid drawings of binary trees

[Shin,Kim,Chwa96] : O(nloglogn) area• Divide and conquer technique• upward straight-line tree drawing

[Chan99] near-linear area bound for planar, straight-line, strictly upward and strongly order-preserving drawings for binary trees[Garg,Rusu02] binary tree with straight-line grid drawing in O(n) area, O(nlogn) time

Page 35: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

35

3D Tree Drawing Algorithm[Hong,Eades00,03] There is a liner time algorithm which constructs symmetric drawings of trees with maximum number of symmetries in three dimensions.

(3) SP Digraphs Drawing Algorithm

1. ∆ Drawing Algorithm [Bertolazzi,Cohen,DiBattista,Tamassia94]

2. Symmetric Drawing Algorithm[Hong,Eades,Lee00]

3. 3D Drawing Algorithms

Series-Parallel DigraphsApplications: scheduling electrical networks, data-flow analysis, data base logic diagrams and circuit layout.

series composition

source

sink

parallelcomposition

G1

G2

G1 G2

G1

G2

1. ∆ Drawing Algorithm

[Theorem] There exist embedded series-parallel digraphs such that their upward straight-line drawings that preserve the embedding requires exponential area

Gn+1

Gn

G0

1. ∆ Drawing AlgorithmDivide and Conquer methodconstruct upward grid drawings with O(n2) arearight-pushed embedding: each transitive edge is embedded on the right most sideDefine a bounding triangle ∆

[Theorem]Algorithm ∆ SP-Draw constructs a strictly upward planar straight-line grid drawing of a series-parallel digraph G with O(n2) area such that isomorphic components of G have drawings congruent up to a translation in linear time.

1. ∆ Drawing Algorithm

Page 36: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

36

2. Symmetric Drawing Algorithm

Symmetry Finding Algorithm

Symmetric Drawing Algorithm

212

[Theorem]The number of symmetries of a series parallel digraph is at most 4.

trivialvertical symmetryhorizontal symmetryrotational symmetry(by 180 degrees)

Symmetries of SP Digraphs

213

Step 1. Construct the Canonical Decomposition Tree.Step 2. Find Symmetries.

2.1 Find_Vertical_Symmetry2.2 Find_Horizontal_Symmetry2.3 Find_Rotational_Symmetry

Step 3. Compute the maximum symmetries.

Algorithm for Finding Symmetries in Series-Parallel Digraphs

P

SSS

P

S S

Step 1. Canonical Decomposition Tree

• can be constructed in O(n) time:[Valdes,Tarjan,Lawler82]

215

1. Construct the Canonical Decomposition Tree.2. Find Symmetries.

2.1 Find_Vertical_Symmetry

2.1.1 Vertical_Labeling2.1.2 Vertical_Check

2.2 Find_Horizontal_Symmetry2.3 Find_Rotational_Symmetry

3. Compute the maximum symmetries.

Step2. Find Symmetries2.2 Find_Horizontal_Symmetry

216

2.1.1 Vertical_Labeling

Labeling the Canonical decomposition tree.• Compute an integer codeV(u) for each node

s.t. if u1 and u2 are on the same level, thenthey are isomorphic iff codeV(u1) = codeV(u2).

• Use labels to compute isomorphism classes for each subtree.

Page 37: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

37

P

SSS

P

S S

(0) (0) (0)(0)

(1,1) (1,1)

(0)(0) (1,1) (0) (0) (0)(0)

(1,1)(1,2,1) (1,1)

(1,1,2)codeV(u)tupleV(u)sort at Pnode

1 1 11

1 1

11 2 1 1 11

12 1

1

Parallel_vertical_check(r)1. Partition the children vi of r into

isomorphism classes (codeV(vi)).2. if (all the classes have even size)

then return(true);else if (more than one has odd)then return(false).

else /* only one has odd size */return(vertical_check(v))

2.1.2 Vertical_Check

334

112 2

Series_vertical_check(r)If vertical_check(v)

for every child v of u, then return(true)else return(false)

556 6

334

112 2

2.1.2 Vertical_Check

220

1. Construct the Canonical Decomposition Tree.2. Find Symmetries.

2.1 Find_Vertical_symmetry2.2 Find_Horizontal_Symmetry

2.2.1 Horizontal_Reverse2.2.2 Horizontal_Labeling2.2.3 Horizontal_Check

2.3 Find_Rotational_Symmetry3. Compute the maximum symmetry.

2.2 Find_Horizontal_Symmetry

Direction-reversingsymmetry

Reverse the order of the children of S nodes of half of the graph.

2.2.1 Horizontal_Reverse2.2.2 Horizontal_Check

Series_horizontal_check(r)1. if ( tupleH(r) is not a palindrome)

then return(false);2. if (tupleH(r) is a palindrome and

has even length)then return(true);

3. if (tupleH(r) is a palindrome buthas odd length)

then return(horizontal_check(v))v: middle node of the palindrome.

1

2

1

1

2

2

1

Page 38: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

38

2.2.2 Horizontal_Check

Parallel_horizontal_check(r)if horizontal_check(v)

for every child v of r,then return(true)else return(false).

1 2 3

224

1. Construct the Canonical Decomposition Tree.2. Find Symmetries.

2.1 Find_Vertical_Symmetry2.2 Find_Horizontal_Symmetry2.3 Find_Rotational_Symmetry

2.3.1 Rotational_Reverse2.3.2 Rotational_Labeling2.3.3 Rotational_Check

3. Compute the maximum symmetries.

2.3 Find_Rotational_Symmetry

2.3.3 Rotational_Check

Parallel_rotational_check(r)1. Pair the children v1, v2, …, vk of r

s.t. tupleR(vi) is the reverse oftupleR(vj)

2. if (all of them are paired)then return(true);

3. if (more than one is not paired)then return(false);

4. if (only one is not paired)then return(rotational_check(v)) 1

2

3

4 1

2

3

45

6

6

5

226

Step 3. Computing the Maximum Symmetries

{ trivial }size 2 :

{ trivial, Vertical Symmetry }{ trivial, Horizontal Symmetry }{ trivial, Rotational Symmetry }

size 4 : { trivial, Vertical, Horizontal, Rotational }

Straight line drawing : exponential area.

Visibility drawingBus orthogonal drawingPolyline drawing

2. Symmetric Drawing Algorithm

O(n2) area

D1

D2

Visibility DrawingD1

D2(stretched)

Seriescomposition

D1 D2 (stretched)

Parallel composition

Page 39: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

39

Bus Orthogonal Drawing Polyline Drawing

[Theorem]

There exists a linear time algorithm which constructs symmetric drawings of series-parallel digraphs with maximum number of symmetries.

Symmetric Drawing of SP Digraphs 3. 3D SPD Drawing Algorithms[Hong,Eades,Quigley,Lee98] • minimize footprint (volume)• dynamic programming• quadratic time

[Hong,Eades00,02]• maximize symmetry• liner time algorithm

[diGiacomo,Didimo,Liotta,Wismath02] • book embedding

[diGiacomo,Liotta,Wismath02] • box drawing

We have learnedBasic concepts and terminology for graph drawing• Planar graphs• Embeddings• Planar straight-line drawing/ orthogonal drawing• Visibility representation• Planarization method

Algorithms for drawing • Trees: layered, radial, HV drawing, …• Series parallel digraphs: ∆-Drawing, Symmetric

drawing, 3D Drawing…

Summary of Lecture 2 Lecture 3

Drawing Undirected Graphs:Force Directed Methods

(Spring Algorithm)

(1) Overview: Spring Embedder

(2) Force Directed Methods

(3) Fast Spring Method

Page 40: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

40

(1) Overview: Spring methodsSpring methods are quite popular.1. Place forces between pairs of nodes;

for example:spring forces for edgesgravitational repulsion for nonedges

2. Find a zero force configuration.

1. 2.

236

Example

© Sander

AdvantagesRelatively simple & easy to implementGood flexibilityHeuristic improvements easily addedHandle domain constraintsSmooth evolution of the drawing into the final configuration helps preserving the user’s mental mapCan be extended to 3DOften able to display symmetriesWorks well in practice for small graphs with regular structureShow some clustering structureCan show proximity relations

Disadvantages

Slow running timeResults are acceptable, but not brilliantFew theoretical results on the quality of the drawings producedDifficult to extend to orthogonal & polyline drawingsLimited constraint satisfaction capability

(2) Force-Directed MethodsUse a physical analogy to draw graphsView a graph as a system of bodies with forces acting between the bodies.The algorithm seeks a configuration of the bodies with locally minimal energy: a position of each body such that the sum of the forces on each body is zero.• Vertex: electrically charged particles that repel

each other• Edge: spring that connect particles• Equilibrium configuration: the sum of forces on

each particle is zero

There are many force directed methods: In general, they have two parts: model & algorithmForce system• The model: a force system defined by vertices &

edges• The algorithm: a technique for finding an

equilibrium state, that is the sum of the forces on each vertex is zero.

Energy system• The model: maybe defined as an energy system• The algorithm: a technique for finding a

configuration with locally minimal energy

Force-Directed Methods

Page 41: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

41

Very popular• Relatively simple to implement• Good result

Many variations1. Spring & electrical force2. Barycenter method3. Force simulating graph theoretic

distance4. Magnetic field5. General energy function6. Constraints

Force-Directed Methods 1. Springs & electrical forcesUse a combination of spring & electrical forces• Edge: modeled as spring• Vertex: equally charged particles which repel

each otherThe force on v : F(v) = Σ f u,v + Σ g u,v

f u,v : force on v by the spring between u an v: follow Hook’s law (proportional to the

difference between the distance between u and vand the zero-energy length of the spring)g u,v : Electrical repulsion exerted on v by vertex u

: follow inverse square law

VxV(u,v)∈E(u,v)∈

d(p,q) : Euclidean distance between points p and qpv = (xv, yv): position of vertex vx component of the force on v

F(v) = Σ k1uv ((d(pu, pv) - luv) (xv - xu) + Σ k2

uv (xv - xu) d(pu, pv) (d(pu, pv))2 d(pu, pv)

lu,v : natural (zero energy) length of the spring between u and v: if the spring has length lu,v (d(pu, pv) = lu,v, then no force exerted by (u, v)

k1u,v : stiffness of the spring between u and v

: the larger k1u,v , the more tendency for the distance between u

and v to be close to lu,v.

k2u,v : the strength of the electrical repulsion between u and v

VxV(u,v)∈E(u,v)∈______ ______ ______

The model aim to satisfy two aesthetics• Spring force between adjacent vertices: ensure

the distance between adjacent vertices u and v is approximately equal to lu,v

• Electrical force aim to ensure that vertices should not be close together

[Eades84] logarithmic spring, rather than Hook’s lawF(v) = k1

uv log d(pu, pv) xv - xuluv d(pu, pv)

One may choose parameters luv k1u,v k2

u,v to customize for specific applications.

____________( )

There are many technique to find an equilibrium configuration (or minimum energy)

“Follow your nose”: simple algorithm• Initially at random location• At each iteration:

– Force F(v) on each vertex is computed– Each vertex v is moved in the direction of

F(v) by a small amount proportional to the magnitude of F(v)

• Not the fastest, but allow smooth animation

[Eades84] Spring EmbedderVertex: ringEdge: springAttraction force Fa: nodes connected by a springRepulsive force Fr: disconnected nodesFa(d)=Ka log(d)Fr(d)=Kr /d2

d: current distance between nodes

Calculating attractive forces only between neighbors: O(|E|)Calculating repulsive forces between all pair of vertices: O(|V|2), bottleneck of n-body algorithm in general

Page 42: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

42

Two aesthetic criteria• Uniform edge length• Symmetry

Replace the vertices by rings and the edges by springsInitial layout and let the system go to the minimal energy stateTwo practical adjustment

1. Logarithmic strength spring • Hook Law (linear) spring is too strong when the vertices are far• force on a ring by a spring: C1*log(d/C2)

d is the length of the spring2. Make nonadjacent vertices repel each other

• Inverse square law force: C3/(d)2

d: distance between vertices

[Eades84]Algorithm Spring (G)1. Place the vertices in random locations2. Repeat M times

2.1 Calculate the force on each vertex2.2 Move the vertex C4*(force on vertex)

3. Draw the graph G

C1=2.0, C2=1.0, C3=1.0, C4=0.1, M=100Acceptable running time |V|=50Poor layout for dense graphsOne of the most popular method for drawing undirected graphs with straight-line edges

Use springs with natural length 0, and attractive force proportional to the lengthPin down the vertices of the external face to form a given convex polygon (position constraint)Let the system go…The final configuration is the state of minimum energy: min Σ[length(e)]2

Equivalent to the barycentric mapping p(v) = 1/ deg(v) Σ p(w)e

(v,w)

2. Barycenter Method [Tutte60,63] luv = 0, k1u,v = 1, no electrical force

F(v) = Σ (pu- pv), : trivial solution pv = 0 for all vPartition V into two sets: at least 3 fixed vertex, free vertex (fixed vertices are nailed down)Σ (xu- xv) = 0: choose pv so that F(v) = 0 for all free verticesΣ (yu- yv) = 0deg(v) xv - Σ xu = Σ x*

w , N0 (N1) : set of fixed (free) neighbordeg(v) yv - Σ ψu = Σ y*

w , fixed position for fixed vertex w (x*w ,y*

w)Place each free vertex at the barycenter of its neighbor

E(u,v)∈

E(u,v)∈

E(u,v)∈

N1(v)u∈ N0(v)w∈

N1(v)u∈ N0(v)w∈

Algorithm Barycenter-DrawInput: partition of V,

V0: at least 3 fixed verticesV1: set of free verticesStrictly convex polygon P with V0 vertices

Output: position pv

1. Place each vertex u in V0 at a vertex of P and each free vertex at the origin

2. RepeatFor each free vertex v do

xv = 1 Σ xudeg(v)

yv = 1 Σ yudeg(v)

Until xv and yv converge for all free vertices v

E(u,v)∈

E(u,v)∈_____

_____

In practice, the simple Newton-Raphson iteration in algorithm Barycenter-Draw converges quickly

Matrix from the equation can be solved in O(n1.5) time for planar graphs [LRT79]

[Theorem] [Tutte63] G: triconnected planar graphs, fis a face in a planar embedding of G, and P is a strictly convex planar drawing of f. Then applying Barycenter-Draw with the vertices of f fixed and positioned according to P, yields a convex planar drawing of G.

Display of symmetryPoor resolution [EG96]: exponential area

Page 43: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

43

3. Force simulating graph theoretic distance [Kamada Kawai 89]

model graph-theoretic distance with Euclidean distanceThe forces try to place vertices so that their geometric distance in the drawing is equal to their graph theoretic distanceFor each pair of vertices (u, v) use a spring with natural length dist(u, v)δ(u,v): graph-theoretic distance

: # of edges on a shortest path between u and vAim: find a drawing such that for each pair of vertices, the Euclidean distance d(pu, pv) is approximately proportional to δ(u,v)i.e. System has a force proportional to d(pu, pv) - δ(u,v)

potential energy in the spring between u and v:½ kuv (d(pu, pv) - δ(u,v))2

Choose stiffness parameter: springs between vertices that have small graph theoretic distance are strongerkuv = k / δ(u,v)2

Thus, energy in (u, v): η = k/2 (d(pu, pv)/δ(u,v) – 1)2

Energy in the whole drawing is the sum of individual energies:η = k/2 Σ (d(pu, pv)/δ(u,v) – 1)2

Algorithm seek a position pv=(xv, yv), for each vertex vto minimize η

η / xv = 0, η / yv = 0, v V : non linear equationminima: when partial derivations η w.r.t x(y)of are zero

Eu v∈≠

∂ ∂ ∂ ∂ ∈

However, iterative approach can solve the equation

At each step, a vertex is moved to a position that minimizes energy, while other vertices remain fixed

Choose a vertex that has the largest force acting on it, that isis maximized for all v in V.

22

+vv yx

ηη∂∂

∂∂

∂( ) ( )

Based on Spring embedder model, two criteria• Minimize the number of edge crossings• Uniform distribution of vertices & edges

Find local minimum energy according to the gradient vector σ = 0Finding a global minimum is difficult: Find a local minimum firstMove to new positions if it reduce the total energyMove one vertex at a time: choose a vertex that is in the worst locationRepeat until it converge (when the improvement is less than a fixed small threshold)The algorithm may search for a new local minimum by swapping pair of nodes and then repeat the procedure.Extended into 3D [Kumar and Fowler 94]

4. Magnetic Fields [SM95]Some or all of the springs are magnetized• There is a global magnetic field that acts on the spring• Magnetic field can be used to control the orientation of

edges: broader model3 types of magnetic fields• Parallel: all magnetic forces operate in the same

direction• Radial: the forces operate radially outward from a point• Concentric: the force operates in concentric circles

The three basic fields can be combined(eg) encourage orthogonal edges with a combination of parallel forces in the horizontal & vertical directions

The springs can be magnetized in two ways:• Unidirectional: the spring tends to align with

direction of the magnetic field• Bidirectional: the spring tends to align with the

magnetic field, but in either direction

A spring may not be magnetized at all

Page 44: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

44

The magnetic field induces a torsion or rotational force on the magnetic springs.Unidirectionally magnetized spring representing (u,v), the force is proportional to d(pu, pv) αθ β

d(pu, pv): Euclidean distance between pu and pvθ: angle between the magnetic field and the line from pu to pv

The magnetic forces are combined with the spring & electrical forceAlgorithm to find equilibrium: “follow your nose”(initially random position and at each iteration move the vertex to lower energy position)

Can handle directed graphs: Unidirectional springs with one of the 3 fields• arcs point downward: downward parallel field• Outward: radial field• Counterclockwise: counterclockwise concentric

field

Can be applied to orthogonal drawings: combined vertical & horizontal field with bidirectional springs

Applied with success to mixed graphs (graph with both directed & undirected edges)

5. General Energy FunctionMost of the energy function η is a simple continuous function of the location of vertices. However, many of aesthetic criteria are not continuousIncluding discrete energy function• The number of edge crossings• The number of horizontal & vertical edges• The number of bends in edges

general energy functionη = λ1 η1 + λ2 η2 + … + λk ηk

ηi : a measure for an aesthetic criterion: may include spring, electrical, magnetic energy

[Davidson & Harel 96] energy function for straight line drawings

η = λ1 η1 + λ2 η2 + λ3 η3 + λ4 η4

η1 = Σu,v V (1/ (d(pu, pv))2 ) : similar to electrical repulsion (vertices do not come too close together)

Σ

ru, lu, tu, bu: Euclidean distance between vertex u and the four side lines of rectangular area (vertices do not come too close to the border of the screen)

η3 = Σ(u,v) E (d(pu, pv))2 : edges do not become too long

η4 : the number of edge crossings in the drawing

))/1()/1()/1()/1(( 22222 uuu

Vuu btlr +++=η

Flexibility of general energy function: allow variety of aesthetics by adjusting λi• [BBS97]: user can choose & adjust system

parameters• [Mendonca94]: how these coefficients can be

automatically adjusted to user’s preference

Main problem: computationally expensive to find a minimum energy state (very slow)• simulated annealing [DH96]…..• Genetic algorithm [BBS97]…

Flexibility ensures popularity

Energy function takes into account vertex distribution, edge-lengths, and edge-crossingsGiven drawing region acts as wallSimulated annealing: flexible optimization techniqueEfficiency: very slow30 nodes and 50 edgesAble to deal with optimization problem in a discrete configuration spaceAim: to minimize (or maximize) the cost function

[Davidson & Harel 96]simulated annealing

Page 45: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

45

Using 3 different energy functions

6. Constraints

Force-directed methods can be extended to support several types of constraints

6.1. Position constraints6.2. Fixed-subgraph constraints6.3. Constraints that can be expressed by force or energy function

6.1. Position constraints

assign to a vertex a topologically connected region where the vertex should remain• Single point: a vertex nail down at a specific

location• Horizontal line: group of vertices arranged on

a layer• A circle: set of vertices to be restricted to a

distinct region

[Ostry96]: constraints vertices to curves and 3D surfaces

6.2. Fixed subgraph constraintsAssign prescribed subdrawing to a subgraph

May be translated or rotated, but not deformed

Considering the subgraph as a rigid body

(eg) Barycentered method: force directed method that constraint a set of vertices to a polygon

6.3. Constraints expressed by forcesConstraints expressed by forces

• Orientation of directed edges: magnetic spring• Geometric clustering of special set of vertices• Alignment of vertices

Clustering can be achieved [ECH97]• For each set C of vertices, add a dummy attractor

vertex vC

• Add attractive forces between an attractor vC and each vertex in C.

• Add repulsive forces between pairs of attractors and between attractors and vertices not in any cluster.

RemarkImprove the efficiency• [FR91]: amenable force functions• [FLM95, Tun92]: use randomization in S.A.• [Ost96]: the equations describing the minimal energy

states are stiff for some graphs of low connectivity.• [HS95]: use combinatorial preprocessing step, good

initial layout

[BHR96] empirical analysis • [FR91],[KK89],[DH96],[Tun92],[FLM95]• No winner, try several methods and then choose the

best

Page 46: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

46

[Frucherterman and Reingold 91]Adaptation of spring embedder modelCriteria• Even distribution of vertices• Minimize edge crossings• Uniform edge length

Node at distance d are attracted to each other by attraction force Fa(d)= d2 / kRepulsive force Fr(d)= - d2 / k• k: optimal distance between nodes in the graph,

calculated from the number of nodes and the size of the drawing area

In each iteration, the forces are calculated for each node and all nodes are moved simultaneouslyThe process is also controlled by a temperature parameter

(3) Faster Spring methodsProblem: Spring methods are too slow for huge graphs

1. pu = some initial position for each node u;2. Repeat

2.1 Fu := 0 for each node u;2.2 For each pair u,v of nodes

2.2.1 calculate the force fuv between u and v;

2.2.2 Fu += fuv;2.2.3 Fv += fuv;

2.3 For each node u, pu += εFu;Until pu converges for all u;

Computingthe forces

takesquadratic

time

FADE [Quigley & Eades01]It is feasible to use1. a spring method, then2. a geometric clustering methodto obtain a good graph clustering.

Graph ClusteredGraph

ef

Barnes-Hutt methodBarnes&Hutt proposed a method of computing forces between stars.

An octree (quadtree) is a simple kind of cluster tree that represents the stars at their current positions.

a

dc

b

root

e f

BLa b d

TL BRc

Barnes-Hutt method

The contents of a subtree of can be approximated by a mass at the centroid.

ef

a

dc

b

root

e f

BLa b d

TL BRc

s

s

Barnes-Hutt method

The force that the subtree s exerts on the star x can approximate the sum of the forces that the nodes in sexert on x.

ef

a

dc

b

root

e f

BLa b d

TL BRc

s

s

Page 47: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

47

Barnes-Hutt method

To compute the force on star x, we proceed from the root toward the leaves.

ComputeForce(star x; treenode t)If the approximation is goodthen return the approximation;else return ΣsComputeForce(x, s), where the

sum is over all children s of t.

A simple method can be used to determine whether the approximation is good; it depends on the mass of nodes and the distance between x and s.

FADE (Barnes-Hutt method)

The Barnes-Hutt method is faster than the usual spring algorithm.

1. px = some initial position for each star x;

2. Repeat2.1 Build the octree;2.2 Foreach star x

ComputeForce(x,root);2.3 Foreach star x, px += εFx;

Until px converges for all x;

In practice,computing all the

forces takesO(n log n) time

FADEObservations• The octree provides a clustering of the data• If the data is well clustered, then BH runs faster• The spring algorithm tends to cluster the data

This means that we can:• Use Barnes-Hutt to compute the clusters as well

as the drawing• Use the octree as the clustering for the clustered

graph

FADEThe Barnes-Hutt method provides a synergy between clustering and layout.

1. pu = some initial position for each node u;2. Repeat

2.1 Build the octree;2.2 Foreach node u

ComputeForce(u,root);2.3 Foreach node u, pu += εFu;

Until pu converges for all u;

Some nodes migrate from one

cluster to the next

Experimental Result

Visual abstraction

Lecture 4

Drawing Directed Graphs:

Layered Drawing (Sugiyama Method)

Page 48: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

48

Layered Drawing

a digraph A possible layered drawing

daVinci

The Sugiyama methodLayered networks are often used to represent dependency relations.

Sugiyama et al. developed a simple method for drawing layered networks in 1979.

Sugiyama’s aims included:• few edge crossings• edges as straight as possible• nodes spread evenly over the page

• The Sugiyama method is useful for • dependency diagrams• flow diagrams• conceptual lattices• other directed graphs: acyclic or nearly acyclic.

Layered Drawing of DigraphsPolyline drawings of digraphs with vertices arranged in horizontal layers[Sugiyama, Tagawa and Toda 81][Eades and Sugiyama 91][GKNV93, GNV88, GM89…..]Attractive in practice: several systemsSugiyama Method: 4 steps• step1. Cycle removal: make acyclic digraph• step2. Layer assignment: assign y-coordinates• step3. Crossing reduction: determine the order of

vertices in each layer• step4. Horizontal coordinate assignment: assign x-

coordinates (Straighten the long edges)

Step 1. Cycle RemovalInput graph may contain cycles1. make an acyclic digraph by reversing some edges2. draw the acyclic graphs 3. render the drawing with the reversed edges

Acyclic graph byreversing two edges

Step 1. Cycle RemovalEach cycle must have at least one edge against the flow• We need to keep the number of edges against the

flow smallmain problem: how to choose the set of edges R so that it is smallFeedback set: set of edges R whose reversing makes the digraph acyclicFeedback arc set: set of edges whose removal makes the digraph acyclicMaximum acyclic subgraph problem• find a maximum set Ea such that the graph(V, Ea)

contains no cycles : NP-hard [Karp72, GJ91]Feedback arc set problem• find a minimum set Ef such that the graph(V, E \ Ef)

contains no cycles : NP-complete [GJ79]

Page 49: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

49

Step 1. Cycle RemovalEdges in E \ Ea will be reversedIf we reverse the edges in a minimal feedback arc set, the digraph has no cyclesAssume no two-cycles (or delete both two edges)

Heuristics1. Fast heuristic2. Enhanced Greedy heuristic3. Randomized algorithm:[BS90]: O(mn) time

– Exact algorithm: [Grotschel et al 85, Reinelt 85]

Maximum acyclic subgraph problem• equivalent to unweighted linear ordering problem:

find an ordering of the vertices, a mapping o such that the # of edges (u,v), o(u) > o(v) is minimized.

Easiest heuristic• take an arbitrary ordering• then delete the edges (u,v) with o(u) > o(v)• May use given ordering: BFS or DFS• No performance guarantee: reverse |E|-|V|-1 edges

(DFS)Heuristic that guarantees acyclic set of size at least ½|E| [BS90]• Delete for every vertex either incoming or outgoing

edges• Linear time

1. Fast heuristic

1. Fast heuristic [BS90] 2. Enhanced greedy heuristic Feedback set problem: equivalent to finding a vertex sequence with as few leftward edges as possible • S=(v1, v2, …, vn): vertex sequence of a digraph G• Leftward edge: (vi, vj) with i > j• set of leftward edges for a vertex sequence forms a

feedback setGreedy cycle removal heuristic [Eades et al 93]• Source & sink play a special role: edges incident to

source & sink cannot be part of a cycle• Successively remove vertices from G • Add each in turn, to one of two lists Sl & Sr, either

the end of Sl or the beginning of Sr• Greedy: choice of vertices to be removed and the

choice of the list to be added

Greedy Cycle Removal [Eades et al 93]• All sinks (sources) should be added to Sr (Sl)• Choose a vertex u whose outdeg(u)-indeg(u) is

maximized and add to Sl• performance

• Can be implemented in linear time and space• Sparse graph: Ea with at least 2/3|E|

Greedy Cycle Removal Greedy Cycle Removal

Page 50: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

50

AnalysisDelete all two cycles before applying Greedy-cycle-removal• Two-cycle: a directed cycle with two edges

[Theorem] G: connected digraph with n vertices & m edges without two cycles. Greedy-Cycle-Removal computes a vertex sequence S of G with at most m/2 – n/6 leftward edges[Theorem] Greedy-Cycle-Removal can be implemented in linear time & spaceSimple & speedySparse graph [EL95][Theorem] G: connected digraph with n vertices & m edges without two cycles. Each vertex of G has total degree at most 3. Greedy-Cycle-Removal computes a vertex sequence S of G with at most m/3 leftward edges

Step 2. Layer AssignmentLayering: partition V into L1, L2, …, LhLayered (di)graph: digraph with layersHeight h: # of layersH-layered graph: digraph with height hWidth w: # of vertices with largest layerSpan of an edgeProper digraph: no edge has a span > 1

Some application, vertices are preassigned to layersHowever, in most applications, we need to transform an cyclic digraph into a layered digraph

Layering Introducing dummy verticesY=1

Y=4

Y=3

Y=2

Step 2. Layer AssignmentRequirements1. Layered digraph should be compact: height & width2. The layering should be proper: add dummy vertices3. The number of dummy vertices should be small

A. time depends on the total number of verticesB. bends in the final drawing occur only at dummy

verticesC. the number of dummy vertices on an edge

measures the y extent of the edge: avoid long edge.Methods1. Longest path layering: minimize height2. Layering to minimize width3. minimize the number of dummy vertices

1. Longest path layeringMinimizing the height

Place all sinks in layer L1Each remaining vertex v is placed in layer Lp+1, where the longest path from v to a sink has length p

Can be computed in linear timeMain drawback: too wide

2. Layering to minimize widthFinding a layering with minimum width subject to minimum height: Precedence-constrained multiprocessor scheduling problem -> NP-complete [GJ79]

Coffman-Graham Layering• Input: reduced graph G(no transitive edges) and W• Output: layering of G with width at most W• Aim: ensure the height of the layering is kept small

[LS77]• Two phases

1. Order the vertices2. Assign layers

Width: does not count dummy vertices

Page 51: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

51

Coffman-Graham LayeringSimple lexicographic order:

First phase: lexicographical orderingSecond phase: ensure that no layer receive more than W vertices

[LS77] height is not too large

Coffman-Graham Layering

3. Minimizing # of dummy verticesone can compute a layering in polynomial time that minimizes the number of dummy vertices [GKNV93]f = Σ ( y(u) - y(v) - 1)

(u,v) V f: sum of vertical spans of the edges in the layering

- # of edges : (# of dummy vertices)Layer assignment problem is reduced to choosing y-coordinates to minimize f

Integer linear programming problem

Methods1. Layering for general graphs [Sander 96]2. Minimizing the height: Longest path layering3. Layering with given width: Coffman-Graham

algorithm: width is important than height4. Minimizing the total edge span (# of dummy

vertices) : relatively compact drawing[Sander 96]1. Calculate y by DFS or BFS2. Calculate minimum cost spanning trees3. Apply spring embedderMin. height with min. # of vertices: NP-complete problem

Remark

Step 3. Crossing ReductionInput: proper layered graph# of edge crossings does not depend on the precise position of the vertices, but only the ordering of the vertices within each layer (combinatorial, rather than geometric)

NP-complete, even only two layers [GJ83]Many heuristics• Layer-by-layer sweep: two layer crossing problem• 1. Sorting• 2. Barycenter method• 3. Median method• 4. Integer programming method: exact algorithm

Crossing Reduction: ordering21

543

76

8 9

1210 11

13 14

21 edge crossings

step 3

2 1

54 3

76

9 8

121011

1413

5 edge crossings

Page 52: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

52

Layer-by-layer sweepA vertex ordering of layer L1 is chosenFor i = 2, 3, …, h• The vertex ordering of Li-1 is fixed• Reordering the vertices in layer Li to reduce

edges crossings between Li-1 and Li

Two layer crossing problem:given a fixed ordering of Li-1, choose a vertex ordering of Layer Li to minimize # of crossings

Several variations: layer-by-layer sweep

Layer-by-layer sweep

Step 3 uses a “layer-by-layer sweep”,from bottom to top.

At each stage of the sweep, we:• hold one layer fixed, and• Re-arrange the nodes in

the layer above to avoid edge crossings.

21

543

76

8 9

1210 11

13 14 L1

L2

L3

L4

L5

L6

fixed

freefixed

freefixed

free

Two layer crossing problem21

543

76

8 9

1210 11

13 14

fixed

free

8 9

1210 11fixed

free

L2

L3

89

1210 11

?

L2

L3

L2

L3

The difficult part is tore-arrange the free layer

Two layer crossing problem

Heuristics1. Barycenter method: place each free node at the

barycenter of its neighbours.2. Median method: place each free node at the median

of its neighbours.

• The problem of finding an optimal solution is NP-hard.

Li

Li+1

fixed

free 1

8 5 7

2

9

6

34

Two layer crossing problemgiven a two-layered digraph G=(L1,L2,E) and an ordering x1 of L1, find an ordering x2 of L2, such that cross(G,x1,x2)= opt(G,x1)• two-layered digraph G=(L1, L2, E): a bipartite

digraph• cross(G, x1, x2): # of crossings in a drawing of G• opt(G,x1): min x2 cross(G, x1, x2)

NP-complete: [EW94]

Simple observation: u and v are in L2the # of crossings between edges incident with u and edges incident with v depends only on the relative positions of u and v and not on the other vertices

Crossing number

Crossing number cuv– # of crossings that edges incident to u make with edges incident v, when x2(u) < x2(v) – # of pairs (u,w), (v,z) of edges with x1(z) < x1(w)

Page 53: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

53

One-sided crossing minimization 1. Sorting MethodAim: to sort the vertices in L2 into an order that minimizes # of crossingsNaive algorithm: O(|E|)2, can be reducedAdjacent-Exchange• exchange adjacent pair of vertices using the crossing

numbers, in a way similar to bubble sort• Scan the vertices of L2 from left to right, exchanging

an adjacent pair u, v whenever cuv > cvu• O(|L2|2) time

Split• quick sort: choose a pivot vertex p in L2, and place

each vertex u to the left of p if cup < cpu, and to the right of p otherwise

• Apply recursively to the left & right of p• O(|L2|2) time in worst case; O((|L2|log (|L2|) in practice

Adjacent-Exchange Split

2. The Barycenter MethodThe most common methodx-coordinate of each vertex u in L2 is chosen as the barycenter(average) of the x-coordinates of its neighborsx2(u) = bary(u) = 1/deg(u) Σ x1(v), v is a neighbor

If two vertices have the same barycenter, then separate them arbitrary by a small amountCan be implemented in linear time

3. The Median MethodSimilar to the barycenter methodx-coordinate of each vertex u in L2 is chosen as the median of the x-coordinates of its neighborsv1, v1, …, vj: neighbors of u with x1(v1) < x1(v2) < …< x1(vj)• med(u) = x1(vj/2)• if u has no neighbor, then med(u) = 0

How to use med(u) to order the vertices in L2: sort L2 on med(u)If med(u) = med(v)• Place the odd degree vertex on the left of the even

degree vertex• If they have the same parity, choose the order of u &

v arbitraryCan be computed in time, using a linear-time median finding algorithm [AHU83]

Page 54: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

54

Analysis[Theorem] if opt(G,x1)= 0, then bar(G,x1)=med(G,x1)=0

Performance guaranteesTheorem 1:

The barycenter method is at worst O(sqrt(n)) times optimal.

Theorem 2:The median method is at worst 3 times optimal.

( )( ) ( )

( )( ) 3)2(

)1(

≤GoptGmed

nOisGoptGbar

3. Median MethodSome intuition behind Theorem 2

(median method is at worst 3 times optimal).

fixed

free v

x nodes x nodesmedian

v

3. Median Method

fixed

free u

x nodes x nodesy nodes y nodesmedian

Some intuition behind Theorem 2(median method is at worst 3 times optimal).

3. Median Method

Median placement:

fixed

free v u

x nodes x nodesy nodes y nodes

xycrossings

xycrossings

xycrossings

Median:3xy crossings

3. Median Method

Optimal placement:

fixed

free vu

x nodes x nodesy nodes y nodes

xy+1crossings

Optimal:xy+1crossings

3. Median MethodMedian: at most 3xy crossingsOptimal: at least xy+1 crossings

Theorem 2: The median method is at worst 3 times optimal.

In practice, there are many good methods, and the median is just one of them.

Page 55: COMP4048 Course Outline COMP4048 Information …shhong/comp4048.pdfCOMP4048 Information Visualisation 2004 Semester 2 Thursday 10 am-12 noon Carslaw Building Room 451 shhong/COMP4408.html

55

4. Integer Programming methodsInteger programming approach may be used for two-layer crossing problem

Solving integer programs require sophisticated technique: branch and cut approach can be used to obtain an optimal solution for digraphs of limited size [JM97]

Advantage: find the optimal solutionDisadvantage: no guarantee to terminate in polynomial time

Successful for small to medium sized digraphs

5. Planarization method [Mutzel97]Use maximal planar subgraph approach

RemarkMedian method seems very attractive

Comparative tests • pseudo-random graphs [EK86, JM97]• real-world digraphs [GKNV93]• No single winner

Use a hybrid approach1. Use the median method to determine the initial

ordering2. Use an adjacent exchange method to refine

Step 4. Horizontal Coordinate Assignment

Bends occur at the dummy vertices in the layering step.We want to reduce the angle of such bends by choosing an x-coordinate for each vertex, without changing the ordering in the crossing reduction stepOptimization problem with constraints• draw each directed path as straight as possible• ensure the ordering in each layer (enforce minimal

distance)It may affect the width of the drawingSome layered drawing requires exponential area with straight linesQuadratic programming problems can be solved by standard methods, but it requires considerable computational resource