Designating Start and End nodes

4 views
Skip to first unread message

amshahan

unread,
Feb 27, 2014, 1:13:31 PM2/27/14
to cs...@googlegroups.com
This is really just a clarification question, but why do we really need to designate the start and end nodes in the stagetext when the start and end nodes could be found by evaluating the island matrix? 

It really adds an unnecessary check to the system, because if there is found to be only one start/end node through the watchdog are we supposed to check that this start/end node is the one specified through the stagetext, and if not are we supposed to throw an error on that?

Daniel Luplow

unread,
Feb 27, 2014, 1:37:00 PM2/27/14
to cs...@googlegroups.com
This is meant to be helpful, and is according to my understanding of the directions, but it makes the most sense to me based on the watchdogs we must look for and after getting some input from Cheyenne.

I'm going to try to hopefully clarify this for a lot of people, based on my own understanding of the project. You should not actually explicitly declare a start or end node in your stagetext file. (do not place ! or . in your stagetext file, Menzies only uses this to make his matrices a little clearer while he's describing how they work). When you copy the explicit program into a stagetext format, most people are copying node for node the contents of the program as stage text. The problem with this is the program itself is flawed, which is why we're trying to fix it.

You should have a start node, with which no other node connects back to, and when you analyze your matrix, it should be the ONLY empty COLUMN in the Adjacency matrix.

You should also have an end node, and this node should not connect back to ANYTHING else in the program. It's adjacency matrix should have an empty ROW, and should be the ONLY empty row.

Once you read in your stagetext file, you should initialize your matrix as it is reading in. The best place to do this is in the EDGE class, as it is already conveniently accessed EVERY time an edge is created. When this edge is created, you should find the location in your matrix (which you can get using the here node link in EDGE and set the correct COLUMN to 1.

After you generate your matrix, you should use this to analyze the rows and columns, if you have a single EMPTY COLUMN, set your start node to the node this column belongs to. If you have a single EMPTY ROW, set this as your end node.
Creatinging a dictionary like keys in GRAPH can be used to store the ROWS of your matrix, where the key self.nodes is used as the index, as it is in order of creation, and will maintain a sort. This allows you to access the correct row to set an edge to with (something like self.m[node_name][node_id] = 1 will place your edge in this dictionary, where node_name is your HERE node in EDGE and node_id is the THERE.ID of the edge node).

Remember before you set the edge of a row = to 1, you must make sure you iterate over the dictionary, and for each list, increase its size to the size of graph.nodes (so that the matrix expands as nodes are added) in order to avoid out of bounds errors.

If you have any questions about a specific idea that I covered send me a reply and quote the part you're confused on, and what exactly you don't understand (try to explain what you think is going on) and I'll try to clarify if I have the time.


On Thu, Feb 27, 2014 at 1:13 PM, amshahan <amsh...@mix.wvu.edu> wrote:
This is really just a clarification question, but why do we really need to designate the start and end nodes in the stagetext when the start and end nodes could be found by evaluating the island matrix? 

It really adds an unnecessary check to the system, because if there is found to be only one start/end node through the watchdog are we supposed to check that this start/end node is the one specified through the stagetext, and if not are we supposed to throw an error on that?

--
You received this message because you are subscribed to the Google Groups "cs310" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cs310+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

amshahan

unread,
Feb 27, 2014, 1:46:30 PM2/27/14
to cs...@googlegroups.com
Alright, thank you for clarifying that issue.

Guy Vignoli

unread,
Feb 27, 2014, 9:33:31 PM2/27/14
to cs...@googlegroups.com
if I could interrupt this for a question. I am tasked with the same part of the project as you guys. Are we supposed to be able to find the start and end node from any stage text given? I am assuming so, and that's why we are having this discussion.


On Thu, Feb 27, 2014 at 9:32 PM, Guy Vignoli <guy.v...@mail.wvu.edu> wrote:
if I could interrupt this for a question. I am tasked with the same part of the project as you guys. Are we supposed to be able to find the start and end node from any stage text given? I am assuming so, and that's why we are having this discussion.


--
Reply all
Reply to author
Forward
0 new messages