A bipartite graph macro

Hideki ISOZAKI NTT Basic Research Labs & Stanford Univ.

Nov. 30, 1990

1 Setup

Include epic.sty and eclbip.sty^{1} in your \documentstyle option as below.

\documentstyle[epic,eclbip]{article}

If your printer driver accepts tpic commands, you should specify eepic.sty after epic.sty.

\documentstyle[epic,eepic,eclbip]{article}

As eepic.sty redefines some macros defined in epic.sty, Do not reverse this order.

2 bipartite environment

A bipartite graph is drawn by bipartite environment. The bipartite environment has five arguments. They represent the following parameters.

1. Maximum width of labels in the left node group.

2. Width of gap between the left node group and the right node group.

3. Maximum width of labels in the right node group.

4. Minimum height of vertical gaps between node labels.

5. Width between a node (bullet) and its label.

Labels in the left node group should be specified by \leftnode in this environment. Labels in the right node group should be specified by \rightnode in this environment.

An edge between a left node and a right node can be drawn by \match command.

If you write

1Electrical Communications Labs

\begin{bipartite}{2cm}{1.5cm}{2cm}{3mm}{2mm}
\leftnode{xxx}
\leftnode{yyy}
\leftnode{zzz}
\rightnode{aaa}
\rightnode{bbb}
\rightnode{ccc}
\match{xxx}{ccc}
\end{bipartite}

you get  _{xxx • yyy • zzz •  aaa • bbb • ccc •}  .

Even if labels are long, you don’t have to type them many times as arguments of \match. You can give short names for \leftnode and \rightnode as options, and you can use them as arguments of \match.

If you write

\begin{bipartite}{2cm}{1.5cm}{2cm}{3mm}{2mm}
\leftnode[x]{xxx is very long}
\leftnode{yyy}
\leftnode{zzz}
\rightnode{aaa}
\rightnode[b]{bbb is very long}
\rightnode{ccc}
\match{x}{ccc}
\match{yyy}{b}
\end{bipartite}

you get _{xxx is very long • yyy • zzz • aaa • bbb is very long • ccc •} .

3 Line attribute

You can draw not only solid lines but also dotted lines and dash lines. epic.sty and eepic.sty define several commands for them. If you want to use

\dashline[65]{3}(x1,y1)(x2,y2)

to draw lines, use \brush command before corresponding \match command.

\brush{\dashline[65]{3}}

If you write

\begin{bipartite}{2cm}{1.5cm}{2cm}{3mm}{2mm}
\leftnode{xxx}
\leftnode{yyy}
\leftnode{zzz}
\rightnode{aaa}
\rightnode{bbb}
\rightnode{ccc}
\match{xxx}{ccc}
\brush{\dottedline{3}}
\match{zzz}{bbb}
\end{bipartite}

you get  _{xxx • yyy • zzz •  aaa • bbb • ccc •}  .