I'm trying to plot a map of downtown Lincoln NE with streetweights ... (2024)

1 view (last 30 days)

Show older comments

Cord on 2 Dec 2022

  • Link

    Direct link to this question

    https://matlabcentral.mathworks.com/matlabcentral/answers/1869597-i-m-trying-to-plot-a-map-of-downtown-lincoln-ne-with-streetweights-for-a-project-but-continue-to-get

  • Link

    Direct link to this question

    https://matlabcentral.mathworks.com/matlabcentral/answers/1869597-i-m-trying-to-plot-a-map-of-downtown-lincoln-ne-with-streetweights-for-a-project-but-continue-to-get

With 56 nodes, it is unrealistic to have 56 entries for each node correct? because there are only 4 possible ways a street intersection can go. The 0 values represent an edge of the control area and the 99999 values represent a one-way that cannot be driven on in that direction. order of direction is up, right, down, left.

streetCorners = {'9th & Q' '9th & P' '9th & O' '9th & N' '9th & M' '9th & L' '9th & K' '10th & Q' '10th & P' '10th & O' '10th & N' '10th & M' '10th & L' '10th & K' '11th & Q' '11th & P' '11th & O' '11th & N' '11th & M' '11th & L' '11th & K' '12th & Q' '12th & P' '12th & O' '12th & N' '12th & M' '12th & L' '12th & K' '13th & Q' '13th & P' '13th & O' '13th & N' '13th & M' '13th & L' '13th & K' '14th & Q' '14th & P' '14th & O' '14th & N' '14th & M' '14th & L' '14th & K' '16th & Q' '16th & P' '16th & O' '16th & N' '16th & M' '16th & L' '16th & K' '17th & Q' '17th & P' '17th & O' '17th & N' '17th & M' '17th & L' '17th & K'};

streetWeight = [0 99999 30260 0;99999 7680 25470 0;99999 21030 26920 0;99999 99999 27710 0;99999 4060 26230 0;99999 99999 25180 0;99999 15370 0 0;0 99999 99999 5280;23890 7760 99999 99999;23720 19560 99999 21030;26090 99999 99999 3820;25400 4080 99999 99999;25540 99999 99999 7340;21160 13870 0 99999;0 99999 2150 8400;99999 6900 2110 99999;99999 13040 2900 19560;99999 99999 3540 4320;99999 4450 2980 99999;99999 99999 2330 11870;99999 16060 0 99999;0 99999 99999 10340;3360 7480 99999 99999;2960 19760 99999 19040;3360 99999 99999 4040;3110 5160 99999 99999;2670 99999 99999 12240;2260 14740 0 99999;0 99999 3600 9450;99999 7740 2780 99999;99999 20490 3750 19760;99999 99999 4360 3060;99999 5230 5410 99999;99999 99999 4530 13260;99999 16840 0 99999;0 99999 99999 10910;3760 6640 99999 99999;2630 21150 99999 20490;1970 99999 99999 4400;4050 4640 99999 99999;3610 99999 99999 14240;2850 16550 0 99999;0 99999 5310 11300;99999 6370 6400 99999;99999 24930 7320 21410;99999 99999 7500 5620;99999 2980 7770 99999;99999 99999 8200 15000;99999 16610 0 99999;0 0 99999 13420;8300 0 99999 99999;8900 0 99999 24930;12090 0 99999 2830;13780 0 99999 99999;11620 0 99999 15030;11010 0 0 99999];

G = digraph(streetWeight,streetCorners);

map = plot(G);

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Answers (1)

Aritra on 23 Mar 2023

  • Link

    Direct link to this answer

    https://matlabcentral.mathworks.com/matlabcentral/answers/1869597-i-m-trying-to-plot-a-map-of-downtown-lincoln-ne-with-streetweights-for-a-project-but-continue-to-get#answer_1199310

Open in MATLAB Online

Hi,

As per my understanding you are trying to plot a map for your project.

To solve this, you are using the “digraph” function. However, you are encountering an error which says:

“Adjacency matrix must be square.”

The digraph function creates a directed graph using a square adjacency matrix.

  • For logical adjacency matrix, the generated graph has no edge weights.
  • For nonlogical adjacency matrix, the graph has edge weights. The location of nonzero entry specifies an edge for the graph, and the weight od the edge is equal to the value of the entry.

You can refer to the below code snippet for more details:

streetCorners = {'9th & Q' '9th & P' '9th & O' '9th & N'};

streetWeight = [0 99999 30260 0;99999 7680 25470 0;99999 21030 26920 0;99999 99999 27710 0];

G = digraph(streetWeight,streetCorners);

map = plot(G);

I'm trying to plot a map of downtown Lincoln NE with streetweights ... (3)

For detail, please see this MathWorks documentation below for more information on “digraph”:

https://www.mathworks.com/help/matlab/ref/digraph.html

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Categories

MATLABMathematicsGraph and Network Algorithms

Find more on Graph and Network Algorithms in Help Center and File Exchange

Tags

  • plot
  • matrix
  • adjacency matrix
  • digraph

Products

  • MATLAB

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


I'm trying to plot a map of downtown Lincoln NE with streetweights ... (4)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

Contact your local office

I'm trying to plot a map of downtown Lincoln NE with streetweights ... (2024)
Top Articles
Latest Posts
Article information

Author: Carmelo Roob

Last Updated:

Views: 5944

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Carmelo Roob

Birthday: 1995-01-09

Address: Apt. 915 481 Sipes Cliff, New Gonzalobury, CO 80176

Phone: +6773780339780

Job: Sales Executive

Hobby: Gaming, Jogging, Rugby, Video gaming, Handball, Ice skating, Web surfing

Introduction: My name is Carmelo Roob, I am a modern, handsome, delightful, comfortable, attractive, vast, good person who loves writing and wants to share my knowledge and understanding with you.