spatialgraph2D

バージョン 3.1.1 (4.46 KB) 作成者: Matt J
Creates a graph object with 2D spatial locations associated with the nodes
ダウンロード: 233
更新 2024/5/7

ライセンスの表示

This submission defines a graph class which allows 2D (x,y) location data to be attached to the nodes. It was designed with mosaic graphs in mind. By a mosaic graph, I mean a graph in which distinct edges may intersect one another only at the nodes. Currently, its main capability is decomposing a mosaic graph into its constituent polygons. As an example, given the graph,
s = [1 1 1 2 3 3 4 4 5 6 7 6 8 9 10 10 12 12 13 14 15 16 17 17 18 19 20 21 20 25];
t = [2 8 18 3 4 23 5 21 6 7 8 11 9 10 11 12 14 13 15 18 16 17 18 25 19 20 1 22 24 26];
G = graph(s,t);
we associate the nodes of G to the following x, y data,
x = [0.5 0 0 0 0.5 1 1.5 2 3 3 3 5.5 6 4 6 6 4 3 2 0.5 -1 -2 -1 1.5 4.5 4.5];
y = [0 0.5 1 1.5 2 2 1.5 1 1 1.5 2 1 0.5 0.5 0 -1 -1 -0.5 -1 -1 1 0.5 0.5 -0.5 -0.5 0];
We can create a spatialgraph2D object using either of the following,
obj=spatialgraph2D(G,x,y);
obj=spatialgraph2D.fromst(s,t,x,y);
Then, we can obtain a polyshape array of all the constituent polygons by doing,
pgon=polyshape(obj);
Or, obtain the node sequences demarcating each polygon with the syntax,
nodeSequences=pgonNodes(obj);
To visualize the decomposition, the class has several plotting methods. The following was used to generate the image thumbnail above.
mosaic(obj);

引用

Matt J (2024). spatialgraph2D (https://www.mathworks.com/matlabcentral/fileexchange/73630-spatialgraph2d), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2018a
R2016b 以降のリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersDirected Graphs についてさらに検索
タグ タグを追加

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
3.1.1

Small efficiency update

3.1.0

MAJOR UPDATE:
*Complete revision of the algorithm that decomposes the graph into polygons, needed to address reported failure cases.
*Added the pgonNodes() method.

2.1.0

Added support for directed graphs

2.0.7

Description update

2.0.6

Description update

2.0.5

The polyshape() method now returns an empty polyshape and labelIndices cell as outputs when no mosaic polygons exist in the graph.

2.0.4

Bug fix dealing with graphs with no polygons present.

2.0.3

Description update

2.0.2

Added support for abbreviated syntaxes spatialgraph2D(G) and spatialgraph2D(G,[[,[],labels)

2.0.1

Minor change which should improve efficiency slightly.

2.0

Removed restriction on multiple mosaics in polyshape() method. All polygons in the graph should now be found, regardless of how they are interconnected.

1.0.4

Edit

1.0.3

Description edit

1.0.2

Description edit

1.0.1

Description edit

1.0.0