Question
Code in javascript/html in JSFiddle an show proof that it works! So you will get to have a little fun with this assignment. You will
Code in javascript/html in JSFiddle an show proof that it works!
So you will get to have a little fun with this assignment. You will model a caffeine molecule as a graph and present that computer model. Edges that are single bonds should be presented with a weight of 1, with a double bond they should have a weight of 2.
Build your model as a Graph. The graph should be able to print all of its Nodes with each adjacent node. You can have a print button or simply call it when the Graph is built.
Output:
H (C) <- there will be 9 of these
C (N,H) <- there will be 3 of these
N (C, C, C) <- there are 3 of these
N (C, C) <- only one of these
etc.
etc
for each element and combination of connected element
For added fun use the code at https://bl.ocks.org/mbostock/3037015 to make a graphical representation of the molecule. Special thanks to Amanda Krummel for modeling Caffeine using the graph associated with this block. While you are at it take a look at blocks and see some of the things you will learn to do in the next class COP4813 http://cop4813eaglin.pbworks.com/w/page/34415594/FrontPage ( https://bl.ocks.org/ )
var graph = {
"nodes": [
{"atom": "O", "size": 16},//
{"atom": "C", "size": 12},//
{"atom":"N", "size": 14},//
{"atom": "C", "size": 12},//
{"atom": "C", "size": 12},//
{"atom": "C", "size": 12},//
{"atom": "N", "size": 14},//
{"atom": "C", "size": 12},//
{"atom": "H", "size": 1},//
{"atom": "H", "size": 1},//
{"atom": "H", "size": 1},//
{"atom": "N", "size": 14},//
{"atom": "C", "size": 12},//
{"atom": "H", "size": 1},//
{"atom": "N", "size": 14},//
{"atom": "C", "size": 12},//
{"atom": "H", "size": 1},//
{"atom": "H", "size": 1},//
{"atom": "H", "size": 1},//
{"atom": "C", "size": 12},//
{"atom": "H", "size": 1},//
{"atom": "H", "size": 1},//
{"atom": "H", "size": 1},//
{"atom": "O", "size": 16}//
],
"links": [
{"source": 0, "target": 1, "bond": 2},//o to c
{"source": 1, "target":2, "bond":1},//c to n
{"source":1, "target":3, "bond":1},//c to c
{"source":3, "target":4, "bond": 2},//c to c
{"source": 2, "target":5, "bond": 1},//first n to c
{"source": 5, "target":6, "bond": 1},//c to second n
{"source": 4, "target": 6, "bond": 1},//double bonded to n
{"source": 6, "target": 7, "bond": 1},//second n to c
{"source": 8, "target": 7,"bond":1 }, //h to c
{"source": 9, "target": 7, "bond":1},
{"source": 10, "target": 7, "bond": 1},
{"source": 11, "target": 4, "bond": 1}, // C to third N
{"source": 11, "target": 12, "bond": 2}, //third n to double c
{"source": 12, "target": 13, "bond": 1}, //c to h
{"source": 12, "target": 14, "bond": 1}, //c to n
{"source": 14, "target": 3, "bond":1},//n to second c
{"source": 14, "target": 15, "bond":1},// n to c
{"source": 16, "target": 15, "bond":1},
{"source": 17, "target": 15, "bond":1},
{"source": 18, "target": 15, "bond":1}, //h3 to c
{"source": 19, "target": 2, "bond": 1}, // first n to c
{"source": 20, "target": 19, "bond": 1},
{"source": 21, "target": 19, "bond": 1},
{"source": 22, "target": 19, "bond": 1}, //h3 to c
{"source": 23, "target": 5, "bond": 2}
]
};
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started