Using osm data

I’m using open street maps past 2 weeks.i don’t know whether it is dumb question.
i’m working for a simple routing application that uses real map data that could return a list of streets to pass by to reach the destination. I came up with a parser(not using any established converters) that could upload the osm data into 2 different tables naturally nodes and ways. nodes table contain the node id and lat and lon. ways table contain the way id , node list making up the way and the way name and highway type.
is it possible to implement a routing algorithm with this data model ? i tried but couldn’t succeed because not every way is connected to other.
any suggestions??

thank you.

Yeah. But ways that are connected have the same node (i.e. they contain the same node id).