TikZ Diagram assigning values to lines/ branches
First, I received help in creating this in this thread: Drawing system in Latex using TikZ.
This is what I currently have. All the arrows are correct in the output. I just don't know how to assign weights to the lines.
begin{tikzpicture}[box/.style={draw,minimum width=1cm,minimum height=8mm},font=sffamily]
begin{scope}[every node/.style={box}]
node (1){1};
node[right=1cm of 1] (5){5};
node[below=3mm of 5] (6){6};
node[above=11mm of 5] (2){2};
node[above=2mm of 2,xshift=8mm] (4){4};
node[right=1cm of 2] (3){3};
node[right=2.5cm of 5] (7){7};
node[right=1cm of 7] (8){8};
node[above=2mm of 8] (9){9};
node[below=2mm of 8] (10){10};
end{scope}
begin{scope}[every edge/.append style={-latex},auto,
hv/.style={to path={-| (tikztotarget) tikztonodes}},
vh/.style={to path={|- (tikztotarget) tikztonodes}},
hvh/.style={to path={-| ([xshift=#1]tikztotarget) --(tikztotarget) tikztonodes}},]
draw (1) ++ (-1,0) edge (1)
(1) edge[vh] (2) (4) edge[hv] (2) (3) edge[vh,"0.4" right] (4)
(1) edge (5) (2) edge (3) (5) edge (7) (7) edge (8) (8) edge ++ (2.2,0)
(3) edge[hv] (7)
(6) edge[hvh=-3mm] (5.-160) (5.-20) edge[hvh=3mm] (6.0)
(9) edge[hvh=-3mm] (8.160) (8.20) edge[hvh=3mm] (9.0)
(10) edge[hvh=-3mm] (8.-160) (8.-20) edge[hvh=3mm] (10.0);
end{scope}
begin{scope}[-latex]
draw (1.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (2.south) -- ++ (-135:0.6) node[pos=1.35]{0.3};
draw (3.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (4.north) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (5.north) -- ++ (45:0.6) node[pos=1.35]{0.1};
draw (6.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (7.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
draw (8.10) -- ++ (0.4,0) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (9.north) -- ++ (45:0.6) node[pos=1.35]{0.3};
draw (10.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
end{scope}
end{tikzpicture}
My question is, how can I assign weights to each of the lines like in the below image.
tikz-pgf
New contributor
add a comment |
First, I received help in creating this in this thread: Drawing system in Latex using TikZ.
This is what I currently have. All the arrows are correct in the output. I just don't know how to assign weights to the lines.
begin{tikzpicture}[box/.style={draw,minimum width=1cm,minimum height=8mm},font=sffamily]
begin{scope}[every node/.style={box}]
node (1){1};
node[right=1cm of 1] (5){5};
node[below=3mm of 5] (6){6};
node[above=11mm of 5] (2){2};
node[above=2mm of 2,xshift=8mm] (4){4};
node[right=1cm of 2] (3){3};
node[right=2.5cm of 5] (7){7};
node[right=1cm of 7] (8){8};
node[above=2mm of 8] (9){9};
node[below=2mm of 8] (10){10};
end{scope}
begin{scope}[every edge/.append style={-latex},auto,
hv/.style={to path={-| (tikztotarget) tikztonodes}},
vh/.style={to path={|- (tikztotarget) tikztonodes}},
hvh/.style={to path={-| ([xshift=#1]tikztotarget) --(tikztotarget) tikztonodes}},]
draw (1) ++ (-1,0) edge (1)
(1) edge[vh] (2) (4) edge[hv] (2) (3) edge[vh,"0.4" right] (4)
(1) edge (5) (2) edge (3) (5) edge (7) (7) edge (8) (8) edge ++ (2.2,0)
(3) edge[hv] (7)
(6) edge[hvh=-3mm] (5.-160) (5.-20) edge[hvh=3mm] (6.0)
(9) edge[hvh=-3mm] (8.160) (8.20) edge[hvh=3mm] (9.0)
(10) edge[hvh=-3mm] (8.-160) (8.-20) edge[hvh=3mm] (10.0);
end{scope}
begin{scope}[-latex]
draw (1.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (2.south) -- ++ (-135:0.6) node[pos=1.35]{0.3};
draw (3.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (4.north) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (5.north) -- ++ (45:0.6) node[pos=1.35]{0.1};
draw (6.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (7.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
draw (8.10) -- ++ (0.4,0) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (9.north) -- ++ (45:0.6) node[pos=1.35]{0.3};
draw (10.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
end{scope}
end{tikzpicture}
My question is, how can I assign weights to each of the lines like in the below image.
tikz-pgf
New contributor
add a comment |
First, I received help in creating this in this thread: Drawing system in Latex using TikZ.
This is what I currently have. All the arrows are correct in the output. I just don't know how to assign weights to the lines.
begin{tikzpicture}[box/.style={draw,minimum width=1cm,minimum height=8mm},font=sffamily]
begin{scope}[every node/.style={box}]
node (1){1};
node[right=1cm of 1] (5){5};
node[below=3mm of 5] (6){6};
node[above=11mm of 5] (2){2};
node[above=2mm of 2,xshift=8mm] (4){4};
node[right=1cm of 2] (3){3};
node[right=2.5cm of 5] (7){7};
node[right=1cm of 7] (8){8};
node[above=2mm of 8] (9){9};
node[below=2mm of 8] (10){10};
end{scope}
begin{scope}[every edge/.append style={-latex},auto,
hv/.style={to path={-| (tikztotarget) tikztonodes}},
vh/.style={to path={|- (tikztotarget) tikztonodes}},
hvh/.style={to path={-| ([xshift=#1]tikztotarget) --(tikztotarget) tikztonodes}},]
draw (1) ++ (-1,0) edge (1)
(1) edge[vh] (2) (4) edge[hv] (2) (3) edge[vh,"0.4" right] (4)
(1) edge (5) (2) edge (3) (5) edge (7) (7) edge (8) (8) edge ++ (2.2,0)
(3) edge[hv] (7)
(6) edge[hvh=-3mm] (5.-160) (5.-20) edge[hvh=3mm] (6.0)
(9) edge[hvh=-3mm] (8.160) (8.20) edge[hvh=3mm] (9.0)
(10) edge[hvh=-3mm] (8.-160) (8.-20) edge[hvh=3mm] (10.0);
end{scope}
begin{scope}[-latex]
draw (1.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (2.south) -- ++ (-135:0.6) node[pos=1.35]{0.3};
draw (3.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (4.north) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (5.north) -- ++ (45:0.6) node[pos=1.35]{0.1};
draw (6.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (7.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
draw (8.10) -- ++ (0.4,0) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (9.north) -- ++ (45:0.6) node[pos=1.35]{0.3};
draw (10.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
end{scope}
end{tikzpicture}
My question is, how can I assign weights to each of the lines like in the below image.
tikz-pgf
New contributor
First, I received help in creating this in this thread: Drawing system in Latex using TikZ.
This is what I currently have. All the arrows are correct in the output. I just don't know how to assign weights to the lines.
begin{tikzpicture}[box/.style={draw,minimum width=1cm,minimum height=8mm},font=sffamily]
begin{scope}[every node/.style={box}]
node (1){1};
node[right=1cm of 1] (5){5};
node[below=3mm of 5] (6){6};
node[above=11mm of 5] (2){2};
node[above=2mm of 2,xshift=8mm] (4){4};
node[right=1cm of 2] (3){3};
node[right=2.5cm of 5] (7){7};
node[right=1cm of 7] (8){8};
node[above=2mm of 8] (9){9};
node[below=2mm of 8] (10){10};
end{scope}
begin{scope}[every edge/.append style={-latex},auto,
hv/.style={to path={-| (tikztotarget) tikztonodes}},
vh/.style={to path={|- (tikztotarget) tikztonodes}},
hvh/.style={to path={-| ([xshift=#1]tikztotarget) --(tikztotarget) tikztonodes}},]
draw (1) ++ (-1,0) edge (1)
(1) edge[vh] (2) (4) edge[hv] (2) (3) edge[vh,"0.4" right] (4)
(1) edge (5) (2) edge (3) (5) edge (7) (7) edge (8) (8) edge ++ (2.2,0)
(3) edge[hv] (7)
(6) edge[hvh=-3mm] (5.-160) (5.-20) edge[hvh=3mm] (6.0)
(9) edge[hvh=-3mm] (8.160) (8.20) edge[hvh=3mm] (9.0)
(10) edge[hvh=-3mm] (8.-160) (8.-20) edge[hvh=3mm] (10.0);
end{scope}
begin{scope}[-latex]
draw (1.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (2.south) -- ++ (-135:0.6) node[pos=1.35]{0.3};
draw (3.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (4.north) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (5.north) -- ++ (45:0.6) node[pos=1.35]{0.1};
draw (6.south) -- ++ (-45:0.6) node[pos=1.35]{0.2};
draw (7.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
draw (8.10) -- ++ (0.4,0) -- ++ (45:0.6) node[pos=1.35]{0.2};
draw (9.north) -- ++ (45:0.6) node[pos=1.35]{0.3};
draw (10.south) -- ++ (-45:0.6) node[pos=1.35]{0.1};
end{scope}
end{tikzpicture}
My question is, how can I assign weights to each of the lines like in the below image.
tikz-pgf
tikz-pgf
New contributor
New contributor
New contributor
asked 2 mins ago
Brandon HabermanBrandon Haberman
31
31
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Brandon Haberman is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472499%2ftikz-diagram-assigning-values-to-lines-branches%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Brandon Haberman is a new contributor. Be nice, and check out our Code of Conduct.
Brandon Haberman is a new contributor. Be nice, and check out our Code of Conduct.
Brandon Haberman is a new contributor. Be nice, and check out our Code of Conduct.
Brandon Haberman is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472499%2ftikz-diagram-assigning-values-to-lines-branches%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown