Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize adjacency multiple tables in Database

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to realize adjacency multiple tables in database". In daily operation, I believe that many people have doubts about how to realize adjacency multiple tables in the database. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to realize adjacency multitables in the database". Next, please follow the editor to study!

1. Introduction:

If we focus on vertices in the application, then the adjacency table is a good choice, but if we focus on edges, then the adjacency table is troublesome.

To delete the edge on the left (V0reV2), you need to delete two nodes in the shadow of the table below.

two。 Storage structure of adjacent multiple tables:

IVex and jVex: the subscript of two vertices attached to an edge in the vertex table.

ILink: points to the next edge attached to the vertex iVex.

JLink: points to the next edge attached to the vertex jVex.

3. Adjacency multiple indicates intention to draw:

Adjacent multiple table typedef char Vtype / / vertex type typedef int Etype / / weight type # definde MAXV 100; typedef struct edgeNode / / edges represent the number of edges {int ivex; / / one end of an edge int jvex; / / the other end of an edge struct edgeNode * ilink; / / depends on the next edge of vertex ivex struct edgeNode * jlink / / next edge weight of type weight;// depending on vertex jvex} EdgeNode; typedef struct Vnode / / vertex table node {Vtype data; EdgeNode* firstEdge; / / corresponding edge} VNODE; / / typedef struct {VNODE adjlist [MAXV]; current number of vertices int numE;// current number of edges} GraphAdjList Void CreateALGraph (GraphAdjList* G) {int iPowerjPowerk; EdgeNode* e = NULL; cout > G-> numE; for / establish vertex information {cin > > G-> adjlist [I] .data; / enter vertex information G-> adjlist [I] .firstEdge = NULL; / edge table node is empty} for KnumE;k++) / / create edge information {couti; coutj; / / notice that every time a new node is inserted, it is done a little around the header of the linked list. E = new EdgeNode; / / (1 new EdgeNode; 3) the insertion of this line is different for the two points 1 and 3, so there are two new e-> ivex = I. E-> ilink = G-> adjlist [I] .firstEdge; / / it used to be e-> next = j. Of. Now is the current G-> adjlist [I]. FirstEdge = e; e-> jvex = j; e-> jlink = G-> adjlist [j] .firstEdge; G-> adjlist [j]. FirstEdge = e;} at this point, the study on "how to implement adjacent multiple tables in the database" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report