Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. need a guidance

need a guidance

Scheduled Pinned Locked Moved Algorithms
algorithmstutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    en411
    wrote on last edited by
    #1

    I have path which is in '*' (asterisk) shape. All the ends are the nodes such that there is 8nodes and one node in the center. I want to form an algorithm that could start the journey from one end and travel to all the other nodes.Can any one guide me through this. How should i proceed the coding?

    A D 2 Replies Last reply
    0
    • E en411

      I have path which is in '*' (asterisk) shape. All the ends are the nodes such that there is 8nodes and one node in the center. I want to form an algorithm that could start the journey from one end and travel to all the other nodes.Can any one guide me through this. How should i proceed the coding?

      A Offline
      A Offline
      Alan Balkany
      wrote on last edited by
      #2

      There are many ways to do this. Probably the simplest is depth-first search, which visits each unvisited node connected to the current node, recursively. To implement this, you need a Boolean "visited" member of the node structure, which is initially false in all nodes. You call the search function with any node to start. The function then sets "visited" to true, and calls itself recursively with each of the node's unvisited neighbors. When it returns at the top level, you've visited all the nodes.

      "Microsoft -- Adding unnecessary complexity to your work since 1987!"

      1 Reply Last reply
      0
      • E en411

        I have path which is in '*' (asterisk) shape. All the ends are the nodes such that there is 8nodes and one node in the center. I want to form an algorithm that could start the journey from one end and travel to all the other nodes.Can any one guide me through this. How should i proceed the coding?

        D Offline
        D Offline
        Dr Hurol Aslan
        wrote on last edited by
        #3

        Hello, Please put a picture of the shape that shows the nodes and paths (lines connecting the nodes) An asterisk has six points, not eight. Maybe you mean a star, then people need to know if you are including the inside corners.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups